The Sync Relational Model Data tab
The Sync Relational Model Data tab
The Sync Relational Model Data tab is the central place to configure and perform relational model data synchronization. This tab is opened by selecting the Project -> Sync Relational Model Data option in the main menu or by clicking the button on the toolbar.
It constists of the following parts:
- Sync Sources management, which is a pane which shows all present syncable elements (database containers, catalogs, schemas) in a tree list structure and their current sync sources. The user can then set the sync sources using combo boxes in the treelist, in one central point without having to navigate through the catalog explorer tree. The dates / times are in Local time.
- Available SyncTasks, which is a grid with 0 or more tasks created from the available syncable elements. The user can enable/disable the tasks by checking/unchecking a checkbox in the grid
- Perform Tasks button, which starts the enabled tasks
- Sync Results, which is a small pane with the last sync date/time of the session (not stored in the project file) and the last log of that last session, so the user can check these later if the form has been closed.
- A way to locally override the set sync sources. This is discussed more in detail below.
Everything is automatic, if you change a value, the tasks are re-created, so they're always up to date.
Sync doesn't perform DDL SQL export / SQL migration, you have to export and run DDL SQL scripts manually as that's in line with the philosophy of the LLBLGen Pro Designer.
Sync Source Management
The Sync Source Management area allows you to specify which source to use for synchronization per syncable element (database containers, catalogs, schemas). Sync sources can be one of the following
- Model. This means the relational model data is following the model and is synced with the model by forward mapping the model onto the relational model data ('Model first')
- Database. This means the relational model data is following the database schema of an external database server and is synced by refreshing it from the server. ('Database first')
- Mixed. This means the relational model data is obtained from the database for implied elements (stored procedures, table-valued function calls, views, sequences), and from the model for tables.
If you want to have your entities being forward mapped onto tables ('Model first') but also want e.g. views or stored procedures in the same schema obtained from the database server, you can: set the sync source for the schema to Mixed.
When an older project is loaded into v5's designer, or is converted from v2 to v5's format, there are no sync sources defined, and the designer will pick a default which is Database.
Overriding sync sources locally
When multiple people work on the same project it can be some will define entities using the designer, and thus use model first, and some will reverse engineer entities from tables, and thus use database first. The model-first using people will use the Model as sync source, however the people who use database-first will need to set the sync source to Database.
As this is a manual, and thus error prone, operation, the designer can help with this by offering local overrides for sync sources. To enable local overrides for one or more sync sources, please check the 'Enable local sync sources overrides' checkbox at the bottom of the Sync Source Management grid. Once checked, the grid will offer two extra columns, as shown below.
The Sync Relational Model Data tab with local overrides enabled
In the example above, the 'dbo' schema has a local override: instead of syncing that schema with the database, as it's defined in the project, it'll sync with the model. All other schemas have no local overrides and will use the defined sync source as it's defined in the project. The effective sync source that'll be used is shown in the 'Effect Sync Source' column.
Local sync source persistence
Which sync sources have local overrides is persisted in a separate file, with the name projectfile.syncoverrides. So the project file 'Northwind.llblgenproj' will have its local sync source overrides stored in the file 'Northwind.llblgenproj.syncoverrides'. This file is loaded automatically when the project is loaded. When you save the project this file is written as well.
As they're meant for local overrides, the central llblgenproj project file can be kept in central storage and the separate syncoverrides files can be kept separately. When the sync overrides file is lost, the sync sources defined in the project are used.
What's done per sync source value
When you sync the relational model data, the designer will start the synchronization process for all relational model data and make sure the data is synced with their sources. The list below shows what the designer will do with a given element for a given sync source.
Relational model data container
- Model: it will sync the tables / sequences with the entity model in all catalogs in the container
- Database: it will refresh every catalog with the database server. All elements are obtained
- Mixed: it will refresh every catalog with the database server and it depends on the schema sync sources whether their tables are included.
Catalog
- Model: it will sync the tables / sequences with the entity model.
- Database: it will refresh the catalog with the database server. All elements are obtained
- Mixed: it will refresh the catalog with the database server and it depends on the schema sync sources whether their tables are included.
Schema
- Model: it will sync the tables / sequences with the entity model
- Database: it will refresh everything with the database, tables included
- Mixed: it will sync the tables / sequences with the entity model, and it will refresh the rest from the database (views, stored procedures, table-valued function calls)
Refreshing a catalog with sync source set to 'Mixed' or at least a schema with sync source set to 'mixed' will retrieve meta-data from the database server but there is no table meta-data retrieved for these schemas. The user is therefore not able to (de)select tables as they're synced from the entity model. Sequences are retrieved in this scenario however.
Sync Tasks
Based on the relational model data elements in the project and the selected sync sources for these elements, the designer creates Sync Tasks, which are shown in the Available Sync Tasks area in the Sync Relational Model Data tab. Per task the source and the involved elements are given as well as an option to enable/disable the task.
To perform the tasks in one go, you click Perform Tasks. By default a log is shown with all the actions performed during the execution of the enabled tasks. If you don't want a log to be shown, uncheck the checkbox Show log after sync has been completed. The default value for this checkbox is set in the Designer preferences setting Show report after relational model data sync.
See for more information regarding Sync Tasks the Sync Task Aspects section.