Available Output Settings
The following settings are available for the Entity Framework Core v2. There are two sections, one for the global defaults, which you can edit in the Project Settings Editor of the designer, and one which discusses the settings available per element, and which default setting sets their default value. This way you can easily track which default to set for which element setting.
Defaults
The following default settings and attributes are available, which control the default value for settings available per element.
Settings
These settings are edited using the Project Settings Editor, Output Setting Values tab.
- CollectionNavigatorTypeDefault
- This setting specifies the default value for the CollectionNavigatorType setting of a navigator. Default value:
List <T>
. - EntityBaseClassNameDefault
-
This setting specifies the default value for the EntityBaseClassName setting of an entity. Default value:
CommonEntityBase
- MapUnmappedFieldsAsShadowPropertiesDefault
- This setting specifies the default value for the MapUnmappedFieldsAsShadowProperties setting of an entity. Default value:
false
. - TypedListRowBaseClassNameDefault
-
This setting specifies the default value for the TypedListRowBaseClassName setting of a typed list. Default value: empty string
- UsePrivateBackingFieldDefault
-
This setting specifies the default value for the UsePrivateBackingField setting of an entity / valuetype field. If set to true (Default: false) instead of a public property a private backing field in the class is used for the field. Default value:
false
. - ValueTypeBaseClassNameDefault
- This setting specifies the default value for the ValueTypeBaseClassName setting of a valuetype. Default value:
CommonValueTypeBase
Element Settings
The following settings are available per element. These settings are edited on the element's own editor (or the containing element's editor, in the case where the element itself doesn't have a separate editor) on the Code-gen info tab, or on the Project Settings Editor, if the element is the project.
Entity definition settings
- EntityBaseClassName
-
The name of the base class for a generated entity class. The following macros are available:
{$Name}
for the entity name without group name,{$GroupName}
for the name of the group the entity is in,{$FullName}
for the group name plus entity name. Sub-types will always inherit from their super-type and not from the class specified. Default value: the value of the default EntityBaseClassNameDefault. - MapUnmappedFieldsAsShadowProperties
-
This setting controls whether unmapped fields in the target table are mapped as Shadow Properties in the entity mapping (true) or not (false). Setting is ignored on entities which are part of an inheritance hierarchy of type Target per Entity Hierarchy. Default value: the value of the default MapUnmappedFieldsAsShadowPropertiesDefault
Value Type Definition settings
- ValueTypeBaseClassName
-
The name of the base class for a generated valuetype class. The following macros are available: {$Name} for the valuetype name without group name, {$GroupName} for the name of the group the valuetype is in, {$FullName} for the group name plus valuetype name. Default value: the value of the default ValueTypeBaseClassNameDefault.
Field settings (entity definition field)
- ForcedValueGenerationPattern
-
This setting specifies the forced value for ValueGenerationPattern on the mapped target. By default, the setting is set to None, which means the value for ValueGenerationPattern is left to the designer (which means it will emit the proper mapping code automatically for Identity fields). This setting allows you to specify ValueGeneratedOn* calls on field mappings which aren't identity fields. Use this setting with value 'ValueGeneratedOnAddOrUpdate' on timestamp fields combined with setting 'UseForOptimisticConcurrencyChecks' to true for concurrency tokens based on timestamp fields.
- GenerateAsReadOnlyProperty
- This setting specifies whether the field is generated as a read-only property with a backing field (true) or as an auto-property with a get/set pair (false, default). If set to true and the field is defined as read-only in the entity, it overrules the value of the project level setting GenerateReadOnlyFieldsAsReadOnlyProperties.
The DTO persistence templates can't see the value of the GenerateAsReadOnlyProperty setting, as they don't know that setting (they're generic for all ORMs). This means that when using DTO models and the read/write preset for the DTO classes framework, the value of this setting is ignored and the property is assumed to be writable (as it is effectively read/only). This will likely cause incompilable code. In this situation, the setting should be set to false. Readonly fields marked as such in the entity are correctly handled.
- UseForOptimisticConcurrencyChecks
-
This setting controls whether the field is used in optimistic concurrency checks (true) or not (false, default). Default value: false
- UsePrivateBackingField
-
If set to true (Default: false) instead of a public property a private backing field in the class is used for the field. Default value: the value of the default UsePrivateBackingFieldDefault
Project settings
- EmitForeignKeyFields
-
This setting controls whether a generated entity class will have visible foreign key fields (true, default) or not (false). Default value: true. If set to false, the foreign key fields will be generated as shadow properties.
- GenerateReadOnlyFieldsAsReadOnlyProperties
- This setting controls whether a read-only entity field will be generated as a read-only property with a backing field (true) or as an auto-property with a get/set pair (false, default).
Typed List definition settings
- TypedListRowBaseClassName
-
The name of the base class for a generated typed list row class. The following macros are available:
{$Name}
for the typed list name without group name,{$GroupName}
for the name of the group the typed list is in,{$FullName}
for the group name plus typed list name. Default value: the value of the default TypedListRowBaseClassNameDefault
Navigator settings
- CollectionNavigatorType
- The type of the navigator in the entity class. Default is
List<T>
. Possible values are:IEnumerable<T>
,ICollection<T>
andList<T>
. Default value: the value of the default CollectionNavigatorTypeDefault.