Available Output Settings, Entity Framework v5
The following settings are available for the Entity Framework v5. 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
- 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. TThis 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. 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.
Note: |
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)
- 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
- 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
- EmitForeignKeyFields. This setting controls whether a
generated entity class and entity type in the edmx file will have
visible foreign key fields (true) or not (false, default). The default
setting (false, no foreign key fields present in edmx file nor the
entity classes) is compatible with v1 of the Entity Framework.
Default value: false
- 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
- 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
- EnableLazyLoadingOnContext. This setting specifies whether
lazy-loading should be enabled at the context level (true) or not
(false, default).
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
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