Code Generation Settings
This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.
The Code Generation tab page enables you to specify various additional code generation options, such as generation template, mapping type, and output folder for the generated objects.
- Code Generation Template - choose a template for the objects generation. The default template could be used or a custom one could be chosen.
-
Copy Default To... - copies the default code generation templates to a folder in the project`s directory.
For more information about the Code Generation Templates, check out the Customizing Code Generation section.
-
Mapping Type - specifies the mapping type that is used for a Telerik Data Access application:
- Generate Context - if this option is checked, then an OpenAccessContext will be generated for the domain model.
- Generate DataAnnotation Attributes - the Generate DataAnnotation Attributes option specifies if the members of the domain classes should be decorated with the RequiredAttribute, KeyAttribute and StringLengthAttribute attributes. It is useful when you are implementing an ASP.NET MVC or an ASP.NET scenario, since these attributes provide both client-side and server-side validation of the data.
- Implement INotifyPropertyChanged - this option specifies if the generated domain classes should implement the INotifyPropertyChanged interface. It is useful in data binding scenarios when the client-side needs to be aware that the value of a property is changed.
- Implement INotifyPropertyChanging - this option specifies if the generated domain classes should implement the INotifyPropertyChanging interface. It is useful in data binding scenarios when the client-side needs to be notified when the value of a property is changing.
- Implement IDataErrorInfo - this option indicates whether the generated domain classes should implement the IDataErrorInfo interface. You can use it when you need to provide custom error information that the UI can bind to.
-
Implement ISerializable - this option indicates whether the generated domain classes should implement the ISerializable interface. You can use it when you need to serialize the objects you retrieve from the database. By default this option is unchecked.
- Ignore Reference Association - this option indicates whether the reference navigation properties of a given persistent class should be serialized. By default, it is checked and Telerik Data Access will not serialize them.
- Ignore Collection Association - this option indicates whether the collection navigation properties of a given persistent class should be serialized. By default, it is checked and Telerik Data Access will not serialize them.
- Generate Multiple Files - if the Generate Multiple Files option is checked, then different file for each object from the domain model will be generated. If you uncheck this option, then all classes will be defined in a single file.
- Project Folder/File Folder - a destination folder in the solution could be optionally chosen. If a folder is specified, then all objects will be generated in that folder. That settings are enabled only if the Generate Multiple Files option is set to True.
- Generate in Nested Namespaces - when this option is checked, the Code generation engine will respect the class namespaces and generate the classes in the corresponding folders (which will be created automatically by the code generation engine). That setting is enabled only if the Generate Multiple Files option is set to True. For more information about this setting, please refer to How to: Generate Classes in Different Namespaces.