Domain Model Synchronization: Exporting the Domain Model

Domain Modeling with WebRatio Mobile Platform
196 views Published on Feb 17, 2015 | Time 3 min
Applies to: 8.0 or higher

If you are working on a back-end project, once you defined your data structure in the Domain Model, you need to connect it with a persistent database. Using the Domain Model synchronization process, you can transpose the Domain Model elements on the database in terms of tables, views, and columns. In this lesson you learn how to use the synchronization process in WebRatio Mobile Platform, in order to export the Domain Model to a relational database.

Transcript

Table of contents

How to Export the Domain Model

Let's suppose we are working on the "CRM" back-end project in which we already have a Domain Model where we defined the "Company" class. Once you add the database connection, you are ready to make the synchronization.

Notice that each element of the "Company" class has a question mark on its icon. This icon means that there is no element in the connected database attached to the current one.

Let's use the synchronization process to export the "Company" class in the connected database. Once the database connection is ready, let's use the Synchronization to export the "Company" class. We want eventually to create the "company" table on the physical database.
Right-click on the "CRM" database node and select the "Synchronize" option. In the "Database Synchronizer" dialog, expand the "Classes" node.

As you can notice, the unmapped elements are marked with a grey right arrow. Right-click on the "Company" Class item and select the "Export to Database" option, then press the "Next" button.
WebRatio Mobile Platform automatically generates the SQL code necessary to create the company table with all the related columns. You can choose among 3 options to handle the generated code: "Save and Execute", "Execute Only" and "Save only" option. If you choose the "Save and Execute" or the "Save Only" option, an SQL script file will be stored in the "DB Script" folder of the Project. Press the "Finish" button to complete the procedure.

Once the Synchronization process is completed, you can see that all the question marks have been removed. This means that the "Company" class is properly mapped to the "company" table in the physical database.