|
The following guide helps you with initial creation of model objects from existing database tables.
- Make sure your model has no objects, e.g. from the previous runs of the import.
- If your database tables use SQL types that are not mapped to any logical type in the model, define new logical types that map to those SQL types respectively.
- If you want certain tables to be imported as child objects, make sure that there is a foreign key relationship set up to the corresponding parent table, the column names on both ends of the relationship match exactly, and the delete action is set to Cascade.
- If you have multiple tables using the same set of common columns, e.g. create date, create user, last update date, last update user, and you want them to be modeled using a shared field set, then you need to define such a field set in the model first.
- Open the Properties tab (F4) of the Import from Database generator from the Model Enhancement generator folder.
- Set up the database connection and save it either for the generator or as a project default.
- Update the Output Path to where you want the model objects imported. Use the {File} placeholder to indicate the location of individual objects. You can also use the {Module/} placeholder to place objects in different folders based on the SQL server schemas of the corresponding tables.
- Run the generator and review the generated objects.
- If you need to update the model or the database and rerun the generator, then repeat the above steps.
- If the objects were generated properly, then update the Output Path to point to another folder, so that accidentally rerunning the generator wouldn't overwrite your model files.
|