Entities and Mapping Generation

This topic deals with the generation of entities and mapping in Entity Developer for Telerik Data Access.

Currently Entity Developer provides only one Data Access template for generating Telerik Data Access entities and mapping and this template is available only for C#. There is no Visual Basic code generation available for Telerik Data Access. Entity Developer generates fluent mapping for Telerik Data Access.

 

ExpandedToggleIcon        Entities and Mapping Generation

The procedure below lists the steps required to generate entities and mapping for Telerik Data Access.

To generate entities, perform the following sequence of actions:

1.In the Model Explorer window, under Templates, select Data Access. The properties of the selected template are displayed in the Properties window:

Images_TemplatePropertiesTDA

2.(Optional) To generate the Data Contract / Data Member attributes (used to serialize entities), in the Generation section of the Properties window, set the Generate Data Contracts parameter to True.
3.(Optional) To replace the standard date/time stamp in the file header with another tag (e.g. a version control tag for Subversion, Git, etc.), in the Generation section of the Properties window, set the Header Timestamp Version Control Tag parameter.
4.(Optional) To implement individual Equals and GetHashCode methods for each entity class, in the Generation section of the Properties window, set the Implement Equals parameter to True.
5.(Optional) To implement the IValidatable interface for each entity class, in the Generation section of the Properties window, set the Implement Validatable parameter to True.
6.(Optional) To implement the INotifyPropertyChanging and INotifyPropertyChanged interfaces for each model class, in the Generation section of the Properties window, set the Property Change Notifiers parameter to True.
7.(Optional) To generate the extensibility partial void On<property name>Changing and partial void On<property name>Changed methods, in the Generation section of the Properties window, set the Property Change Partial Methods property to True. These methods handle changes of each object property.
8.(Optional) To change the destination folder for generated entity classes, click the three-dotted button in the entry box of the Entities Output parameter and, in the displayed Browse for Folder dialog box, navigate to the required folder. Note that if no destination folder is specified, generated entities classes are stored to the folder, in which the model currently resides. See also the note below this procedure. The value of this property is taken into account during generation only if the File Per Class property is set to True.
9.(Optional) To have each model classes placed into a separate file at code generation, in the Output section of the Properties window, set the File Per Class parameter to True.
10. (Optional) To generate a partial class for each class in the model, in the Output section of the Properties window, set the Generate Partial Class parameter to True.
11. (Optional) Use the Validation Error Messages properties to specify error messages you want to associate with a validation control if validation fails. If you do not want to use hardcoded error messages (e.g. for the sake of internationalization), you can use error messages stored in the application resources. For this, specify the name of the resource type for error messages in the following format: ResourceType=<type name>. Additionally, the resource name for your error message for the corresponding validator must be equal to the name of a property from the ValidationErrorMessages property.
12. (Optional) To specify the validation framework for validating the property values of generated classes, in the Validation section of the Properties window, set the Validation Framework parameter.
13. Save the model to generate entity and/or mapping files.

note Note

If you use Entity Developer as an add-in to Microsoft Visual Studio, in Step 8 of the procedure above, you will be able to select the solution project and project folder to add generated entity instead of a file system folder.

 

ExpandedToggleIcon        See Also


Send feedback on this topic

© 2008 - 2024 Devart. All rights reserved.