Available Output Settings
The following settings are available for the Entity Framework v5 and v6, unless specified that they're specific for either v5 or v6. 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.
Additionally the default attribute definitions per element is given.
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 Properties Editor, Output Setting Values tab.
- EntityBaseClassNameDefault
-
This setting specifies the default value for the EntityBaseClassName setting of an entity. When using a non-POCO/non-IPOCO preset, be sure the class specified derives (in)directly from the generated CommonEntityBase class. Default value: CommonEntityBase
- EmitKnownTypeAttributesForWCFDefault
-
This setting specifies the default value for the EmitKnownTypeAttributesForWCF setting of an entity. Default value: false
- ReturnTypeOfTypedViewOnStoredProcCallDefault (Entity Framework v6+ only)
-
This is the default which controls the setting ReturnTypeOfFetchMethod for Typed Views. Defined on the project level, default value is 'ObjectResult'.
- TypedListRowBaseClassNameDefault
-
This setting specifies the default value for the TypedListRowBaseClassName setting of a typed list. Default value: empty string
- TypedViewRowBaseClassNameDefault
-
This setting specifies the default value for the TypedViewRowBaseClassName setting of a typed view. When using a non-POCO/non-IPOCO preset, be sure the class specified derives (in)directly from the generated CommonTypedViewRowBase class. Default value: CommonTypedViewRowBase
- ValueTypeBaseClassNameDefault
-
This setting specifies the default value for the ValueTypeBaseClassName setting of a valuetype. When using a non-POCO/non-IPOCO preset, be sure the class specified derives (in)directly from the generated CommonValueTypeBase class. Default value: CommonValueTypeBase
Default attribute definitions
The following attribute definitions are defined by default for the Entity Framework v5 and v6. These attribute definitions are edited using the Project Settings Editor, Attributes node.
- Serializable
-
Defined for element types: Entity Definition, Value Type Definition, Typed View Definition, Typed List Definition.
- DataContract(IsReference$=$true)
-
Defined for element types: Entity Definition, Value Type Definition, Typed View Definition, Typed List Definition
- DataMember
-
Defined for element types: Navigator Single Value, Navigator Collection, Normal field (entity, value type), Typed View field, Typed List Field.
If you want to have a 'Field mapped onto a related field' to be serialized as well, add a DataMember attribute definition to the 'Field mapped onto related field' or add it globally for 'Field mapped onto a related field' in the Project Properties, Code gen. Meta-Data Defaults tab. Be aware that if you add it globally, the 'Field mapped onto a related field' can't be readonly, as a DataMember marked property has to have a setter and a read-only 'Field mapped onto a related field' doesn't have a setter.
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 Properties 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. When using a non-POCO/non-IPOCO preset, be sure the class specified derives (in)directly from the generated CommonEntityBase class. Default value: the value of the default EntityBaseClassNameDefault. - EmitKnownTypeAttributesForWCF
-
This setting controls whether the code generator will add KnownType attributes to the generated entity classes for all types used in the class (true) or not (false, default). KnownTypeAttribute is used for WCF serialization and should be used in combination with Data Contracts. Default value: the value of the default EmitKnownTypeAttributesForWCFDefault
Field settings (value type definition field, entity definition field)
- ForcedStoreGeneratedPatternValue
-
This setting specifies the forced value for StoreGeneratedPattern on the mapped target. By default, the setting is set to None, which means the value for StoreGeneratedPattern is left to the designer. Setting this to Identity or Computed will set StoreGeneratedPattern on the target's field if it's not an Identity already. Default value: None
- UseForOptimisticConcurrencyChecks
-
This setting controls whether the field is used in optimistic concurrency checks (true) or not (false, default). Default value: false
Navigator settings
- UseCascadeDeletes
-
This setting controls whether the related entity / entities over this navigator should be automatically deleted when this entity is deleted (true) or should be left alone (false, default). Ignored for navigators mapped onto M:N relationships and navigators which are on the FK side of the relationship. Default value: false
Project settings
- DontUseStrongSpatialTypes
-
This setting controls whether the CSDL in the EDMX file has an annotation which states to set UseStrongSpatialTypes to false (which is emitted by the default). Having this setting to true is required if you use geometry/geography types. It's recommended to leave this setting to true. Default value: true
- EmitAddToEntitySetMethodsInContext
-
This setting controls whether the generated Context class contains AddTo... methods (true), allowing the developer to add an entity to an entity set. Starting with v4, the AddTo methods are considered deprecated by Microsoft and therefore this setting is set to false by default. Default value: false
- EmitForeignKeyFields
-
This setting controls whether a generated entity class and entity type in the edmx file will have visible foreign key fields (true, default) or not (false). Default value: true
- EnableLazyLoadingOnContext
-
This setting specifies whether lazy-loading should be enabled at the context level (true) or not (false, default). Default value: false
- PublicPropertyGettersAndSetters
-
This setting controls whether the generated entity, value type and typed list classes have public getters and setters for properties, like the properties for entity fields. If set to false, the properties will be generated as private for entity and typed view classes and internal for typed list classes. The context class will always have public properties. Default value: true
- ProviderManifestTokenValue
-
This setting specifies the value which is emitted into the SSDL for 'ProviderManifestToken'. This value is necessary sometimes for some providers to be able to generate proper SQL. For example for SQL Server this is the version number, e.g. 2005, 2008 or 3.5 if you're targeting SQL CE Desktop. Default value: empty string
- SetContextClassNameEqualToEdmxModelContainerName
-
This setting controls whether the context class name should be equal to the CSDL model container name in the edmx file. When set to false (default) the context class will have the suffix 'DataContext', when set to true, the context class will have the suffix 'Entities'. Only set this to true if you are planning to use the Edmx file and generated context class with the WCF RIA Services wizard as that wizard otherwise can't find the edmx model and refuses to function. Default value: false
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
Typed View definition settings
- TypedViewRowBaseClassName
-
The name of the base class for a generated typed view row class. The following macros are available:
{$Name}
for the typed view name without group name,{$GroupName}
for the name of the group the typed view is in,{$FullName}
for the group name plus typed view name. When using a non-POCO/non-IPOCO preset, be sure the class specified derives (in)directly from the generated CommonTypedViewRowBase class. Default value: the value of the default TypedViewRowBaseClassNameDefault - ReturnTypeOfFetchMethod (Entity Framework v6+ only)
-
This setting controls the return type of the method which retrieves the results of this typed view, if it's mapped onto a stored procedure resultset. Only set this setting to a value other than ObjectResult if the stored procedure has output parameters.
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. When using a non-POCO/non-IPOCO preset, be sure the class specified derives (in)directly from the generated CommonValueTypeBase class. Default value: the value of the default ValueTypeBaseClassNameDefault