EF Core Template

EF Core template is the default entity and mapping generation template, available both in C# and Visual Basic, that generates classes for entities, enumerated types for enums, and it also generates fluent mapping for them.

EF Core template has the following properties:

Configuration

Entities Configuration Output

Allows specifying the output folder for the generated configuration classes. The value of this property is taken into account during generation only if the Self-Contained Entity Configuration property is set to True.

Project

(This property is available in the Visual Studio add-in only) The name of the Visual Studio project where the generation result will be located.

Project Folder

(This property is available in the Visual Studio add-in only) The name of the folder in the Visual Studio project where the generation result will be located.

Destination Folder

(This property is available in the standalone application only) The directory to contain the generation results.

Self-Contained Entity Configuration

Determines whether to encapsulate the code first configuration code for each entity in a separate class.

General

Description

Description of the template.

Enabled

Indicates whether the template is enabled. Acceptable values are True or False.

File Name

The name of the template file.

Name

The name of the template.

Type

The type of the template.

Generation

Collection Initialization Type

.NET Type used for initialization of the Many end of association. If it is set to None, then no initialization is generated. Acceptable values are Default, HashSet, List, None.

Collection Property Type

.NET type used as a property type for the Many end of associations. Acceptable values are Default, HashSet, ICollection, IEnumerable, IList, IReadOnlyCollection, IReadOnlyList, ISet, List, None.

Generate Data Contracts

Determines whether the DataContract/DataMember attributes used for serialization of entities should be generated. This property is obsolete and not recommended to use in new projects. Use the Serialization Library property instead.

Generate Dummy Comments

Determines whether dummy XML comments will be generated for classes and their members.

Generate GeneratedCode Attributes

Determines whether the GeneratedCode attribute should be generated. It identifies code, generated by a tool, and can be used by code analysis tools to identify computer-generated code.

Generate Serializable Attributes

Determines whether the Serializable attribute used for serialization of classes should be generated.

Header Timestamp Version Control Tag

Setting this option will replace the standard date/time stamp in the file header with the specified tag (e.g. a version control tag for Subversion, Git, etc.)

Implement Clonable

Defines whether each entity class will implement the IClonable interface.

Implement Equals

Defines whether each entity class will implement its own Equals and GetHashCode methods.

Include Environment Variables

Determines whether context configuration will be extended with environment variables when a connection string from the appsettings.json file is used. This property is applied only when using Entity Developer as a Visual Studio add-in. It is ignored in Entity Developer run as a separate application.

Json File Base Path

Specifies the base path for file-based providers when a connection string from the appsettings.json file is used. The special reserved value %CurrentDirectory% means that the current working directory of the application is used as the base path. This property is applied only when using Entity Developer as a Visual Studio add-in. It is ignored in Entity Developer run as a separate application.

Nullable Reference Types

Specifies when C# 8 nullable reference types and non-nullable reference types must be generated. If it is set to Enable, then nullable annotation context will be enabled. If it is set to Disable, then #'#nullable disable' directives will be generated. If it is set to Default, then pre-C# 8.0 classic behavior will be used.

Primitive Default Value Generation

Determines whether Entity Developer should generate initialization for a primitive property based on the database DEFAULT column value.

Property Change Notifiers

Defines whether each model class will implement the INotifyPropertyChanging and INotifyPropertyChanged interfaces.

Property Change Partial Methods

Set this property to True to generate the extensibility partial void On<property name>Changing and partial void On<property name>Changed methods. These methods handle changes of each object property.

Output

Context Output

Allows specifying the output folder for the generated context class.

Project

(This property is available in the Visual Studio add-in only) The name of the Visual Studio project where the generation result will be located.

Project Folder

(This property is available in the Visual Studio add-in only) The name of the directory in the Visual Studio project where the generation result will be located.

Destination Folder

(This property is available in the standalone application only) The directory to contain the generation results.

Entities Output

Allows specifying the output folder for the generated entity classes. The value of this property is taken into account during generation only if the File Per Class property is set to True.

Project

(This property is available in the Visual Studio add-in only) The name of the Visual Studio project where the generation result will be located.

Project Folder

(This property is available in the Visual Studio add-in only) The name of the directory in the Visual Studio project where the generation result will be located.

Destination Folder

(This property is available in the standalone application only) The directory to contain the generation results.

Enum Output

Allows specifying the output folder for the generated enums. The value of this property is taken into account during generation only if the File Per Class property is set to True.

Project

(This property is available in the Visual Studio add-in only) The name of the Visual Studio project where the generation result will be located.

Project Folder

(This property is available in the Visual Studio add-in only) The name of the directory in the Visual Studio project where the generation result will be located.

Destination Folder

(This property is available in the standalone application only) The directory to contain the generation results.

File Per Class

Defines whether each model class will be placed into a separate file when generating code.

Generate Partial Class

Defines whether for each class of the model a partial class will be generated, in which it will be possible to add code that won't be overwritten by the designer.

Model Name As Files Prefix

Defines whether to add the model name to the generated file names as a prefix.

Serialization

Generate Serializable Attributes

Determines whether to generate the Serializable attribute for classes.

Serialization Library

The library used for serialization. You can use one of the following libraries:

Data Contract - DataContractSerializer class is used.
JSON (Newtonsoft.Json) - Newtonsoft.Json library is used for serialization to JSON format.
JSON (Microsoft.Text.Json) - Microsoft.Text.Json library is used for serialization to JSON format.
YAML (YamlDotNet) - YamlDotNet library is used for serialization to YAML format.

Serialize Navigation Properties

Determines when serialization attributes are generated for navigation properties. Can be All, OneEnd, ManyEnd, or None.

Serialize Null Values

Determines whether to serialize NULL values. For example, [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] attribute is generated for nullable properties for the Newtonsoft.Json library if this property is false. For System.Text.Json, the following attribute is generated in this case:  [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)].

Serialize Original Column Names

Determines whether to generate the original column names for serialization. For the Newtonsoft.Json library, the [JsonProperty] attribute is used. For the System.Text.Json library, the [JsonPropertyName] attribute is used. Default value is False.

Validation

Validation Error Messages

Specifies error messages 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.

Email Message

Specifies the error message to associate with a validation control if email validation fails.

Expression Message

Specifies the error message to associate with a validation control if regular expression validation fails.

IPAddress Message

Specifies the error message to associate with a validation control if IPAddress validation fails.

Length Message

Specifies the error message to associate with a validation control if length validation fails.

Numeric Message

Specifies the error message to associate with a validation control if numeric validation fails.

Range Message

Specifies the error message to associate with a validation control if range validation fails.

Required Message

Specifies the error message to associate with a validation control if required validation fails.

Validation Framework

Defines the set of attribute types and its source to be used for validating the property values of generated classes. Acceptable values are EnterpriseLibrary, NHibernateValidator, DataAnnotations, None.

 


Send feedback on this topic

© 2008 - 2024 Devart. All rights reserved.