Entity Developer Tour
Read and get acquainted with the entity model design features, the Entity Developer provides.
1. Creating a Model
To create the Entity Developer model for Visual Studio project, right-click the project in the Solution Explorer and choose Add -> New Item from the popup menu. In the displayed dialog select the type of the Devart model, e.g. Devart Entity Model. Then specify the model name in the Name box and click OK. A Create Model wizard will open.
Tip: You may design entity models with Entity Developer without Visual Studio installed.
Reverse engineering model from existing database
To generate model from existing database, choose Database First approach in Create Model Wizard wizard and click Next. Choose the data provider and specify the connection settings on this page, then click Next.
Choosing Database Objects
Select the check boxes to the right of the database objects to include them to the model. You may include tables, views, stored procedures and functions, and Oracle packages to your models.
Setting Naming Options
Entity Developer allows flexible tweaking for the generated names of the entity sets, classes, methods and their members. You may configure removing and adding of prefixes and suffixes, case and pluralization.
After you finished configuring naming rules, click Next, set namespace and Entity Container name, and click Next again. Now you may generate code for the model immediately or clear the Run generator for model check box and click the Finish button.
2. Editing Model on the Diagram
Diagram is the central part of Entity Developer that introduces visual model representation. Diagram control contains classes with their properties, relations between them, and complex types.
Tip: You can zoom in/zoom out diagram by using mouse wheel while holding CTRL button or by specifying scale in the Zoom box.
Tip: Double-click any object on the diagram to open an editor dialog box for it.
Tip: You can click Layout Diagram button to layout diagram automatically.
Easy Complex Type and Class Hierarchy Creating
To create a complex type, parent or child class from a group of existing class properties, just drag these properties from the class to the diagram sheet and choose the corresponding action in the Choose Action dialog box.
Flexible Mapping Editing
Entity Developer allows you both to map classes to storage entities and to entity SQL query. To set class mapping, right-click the class on the diagram and select Mapping Details from the popup menu.
Tip: Mapping details can also be set for associations. Use the same way to set mapping for the association.
Mapping CUD Operations
With Entity Developer it is easy to map Create/Update/Delete operations to the stored routines, added to the model. Right-click the class on the diagram and select Configure Behavior from the popup menu. Then use appeared dialog box to set up the mapping.
Tip: For more information on using stored routines in the Entity Framework models see our blog article.
3. Validating a Model
When you are editing the model, Entity Developer automatically highlights all model errors on the diagram and in the Model Explorer, and places the error and warning messages in the Error List window.
Tip: If you have corrected your errors, but they still are in the Error List, click the Validate Context Model button on the Model toolbar to refresh error information.
4. Executing LINQ and E-SQL queries
When designing model, and especially when debugging it, it is often necessary to emulate model execution - to execute LINQ and Entity SQL queries. You can check correctness of the entity mapping and view data returned by the model. Also, you can view SQL, generated by LINQ and Entity SQL queries.
Tip:To create a query click the Create New Query button on the Standard toolbar or press CTRL+Q.
Tip: Use Query Type combobox on the Query toolbar to select query language.
5. Generating Code
You can create own unique templates for the application code generation or use one of the existing. New T4 like template language features the full power of C# or Visual Basic in the templates, allowing virtually anything you may want for code generation.
Tip: To open a template for viewing and, if applicable, editing, in the Model Explorer area, expand the Templates node and double-click the required template.