Class DataModelOptions
Data model-related options.
public sealed class DataModelOptions
- Inheritance
-
DataModelOptions
- Extension Methods
Properties
AssociationCollectionAsArray
Enables use of array as collection type for association properties/methods. Otherwise see AssociationCollectionType setting.
- Default:
false
- In T4 compability mode:
false
public bool AssociationCollectionAsArray { get; set; }
Property Value
AssociationCollectionType
When specified, many-sided association property/method will use specified type as return type. Type must be open generic type with one type argument, e.g. IEnumerable<T>, List<T> or ICollection<T>. E.g.
"System.Collections.Generic.List<>"
If not configured, IEnumerable<T> type will be used.
Option ignored if AssociationCollectionType set to true
.
- Default: not set
- In T4 compability mode: not set
public string? AssociationCollectionType { get; set; }
Property Value
AsyncProcedureResultClassNameOptions
Gets or sets name generation and normalization rules for custom mapping class for async stored procedure results wrapper for procedure with multiple returns.
- Default: Pascal, SplitByUnderscore,
Suffix = "Results"
- In T4 compability mode: Pascal, SplitByUnderscore,
Suffix = "Results"
public NormalizationOptions AsyncProcedureResultClassNameOptions { get; set; }
Property Value
AsyncProcedureResultClassPropertiesNameOptions
Gets or sets name generation and normalization rules for custom mapping class properties for async stored procedure results wrapper for procedure with multiple returns.
- Default: Pascal, SplitByUnderscore
- In T4 compability mode: Pascal, SplitByUnderscore
public NormalizationOptions AsyncProcedureResultClassPropertiesNameOptions { get; set; }
Property Value
BaseContextClass
Gets or sets type name (full name with namespace) of base class for generated data context. When not specified, DataConnection type used. Provided type should implement IDataContext interface and it is recommented to use wether DataConnection or DataContext classes or classes, derived from them.
- Default: not set
- In T4 compability mode: not set
public string? BaseContextClass { get; set; }
Property Value
BaseEntityClass
Gets or sets name of class to use as base class for generated entities. Must be a full type name with namespace.
If type is nested, it should use + for type separator, e.g. "My.NameSpace.SomeClass+BaseEntity"
Current limitaion - type cannot be generic.
- Default:
null
- In T4 compability mode:
null
public string? BaseEntityClass { get; set; }
Property Value
ContextClassName
Gets or sets name of data context class. When not set, database name will be used.
If database name not provided by schema provider, "MyDataContext"
used as name.
- Default: not set
- In T4 compability mode: not set
public string? ContextClassName { get; set; }
Property Value
DataContextClassNameOptions
Gets or sets name generation and normalization rules for data context class name when name not provided by user but generated automatically.
- Default: Pascal, SplitByUnderscore
- In T4 compability mode: Pascal, SplitByUnderscore
public NormalizationOptions DataContextClassNameOptions { get; set; }
Property Value
EntityClassIsPartial
Enables partial class modifier applied to entity mapping classes.
- Default:
false
- In T4 compability mode:
true
public bool EntityClassIsPartial { get; set; }
Property Value
EntityClassNameOptions
Gets or sets name generation and normalization rules for entity classes.
- Default: Pascal, SplitByUnderscore, Singular,
PluralizeOnlyIfLastWordIsText = true
- In T4 compability mode: T4CompatNonPluralized, SplitByUnderscore, Singular,
PluralizeOnlyIfLastWordIsText = true
public NormalizationOptions EntityClassNameOptions { get; set; }
Property Value
EntityClassNameProvider
Gets or sets custom name generator for entity class name.
- Default: not set
- In T4 compability mode: not set
public Func<TableLikeObject, string?>? EntityClassNameProvider { get; set; }
Property Value
EntityColumnPropertyNameOptions
Gets or sets name generation and normalization rules for entity column properties.
- Default: Pascal, SplitByUnderscore
- In T4 compability mode: T4CompatNonPluralized, SplitByUnderscore, MaxUpperCaseWordLength=2
public NormalizationOptions EntityColumnPropertyNameOptions { get; set; }
Property Value
EntityContextPropertyNameOptions
Gets or sets name generation and normalization rules for entity table access property in data context class.
- Default: Pascal, SplitByUnderscore, PluralIfLongerThanOne,
PluralizeOnlyIfLastWordIsText = true
- In T4 compability mode: T4CompatPluralized, SplitByUnderscore, PluralIfLongerThanOne,
PluralizeOnlyIfLastWordIsText = true
public NormalizationOptions EntityContextPropertyNameOptions { get; set; }
Property Value
EntityContextPropertyNameProvider
Gets or sets custom name generator for data context property name to access entity table.
- Default: not set
- In T4 compability mode: not set
public Func<TableLikeObject, string?>? EntityContextPropertyNameProvider { get; set; }
Property Value
FindParameterNameOptions
Gets or sets name generation and normalization rules for Find entity extension method parameters.
- Default: CamelCase, SplitByUnderscore,
DontCaseAllCaps = false
- In T4 compability mode: CamelCase, SplitByUnderscore,
DontCaseAllCaps = false
public NormalizationOptions FindParameterNameOptions { get; set; }
Property Value
FunctionTupleResultClassNameOptions
Gets or sets name generation and normalization rules for mapping class for result tuple value of scalar function.
- Default: Pascal, SplitByUnderscore,
Suffix = "Result"
- In T4 compability mode: Pascal, SplitByUnderscore,
Suffix = "Result"
public NormalizationOptions FunctionTupleResultClassNameOptions { get; set; }
Property Value
FunctionTupleResultPropertyNameOptions
Gets or sets name generation and normalization rules for field properies of result tuple value mapping class of scalar function.
- Default: Pascal, SplitByUnderscore
- In T4 compability mode: Pascal, SplitByUnderscore
public NormalizationOptions FunctionTupleResultPropertyNameOptions { get; set; }
Property Value
GenerateAssociationExtensions
Enables generation of associations for foreign keys as extension methods (with entity as extended type).
- Default:
false
- In T4 compability mode:
false
public bool GenerateAssociationExtensions { get; set; }
Property Value
GenerateAssociations
Enables generation of associations for foreign keys as entity properties.
- Default:
true
- In T4 compability mode:
true
public bool GenerateAssociations { get; set; }
Property Value
GenerateDataType
Enables generation of DataType enum value for entity column mapping.
- Default:
false
- In T4 compability mode:
false
public bool GenerateDataType { get; set; }
Property Value
GenerateDbType
Enables generation of database type name for entity column mapping.
- Default:
false
- In T4 compability mode:
false
public bool GenerateDbType { get; set; }
Property Value
GenerateDefaultSchema
Enables generation of Schema name for default schemas in mappings (for tables, views, procedures and functions).
- Default:
false
- In T4 compability mode:
true
public bool GenerateDefaultSchema { get; set; }
Property Value
GenerateFindExtensions
Enables generation of extension methods to access entity by primary key value (using name Find/FindAsync/FindQuery for generated method).
- Default:
FindByPkOnTable | FindAsyncByPkOnTable
- In T4 compability mode: FindByPkOnTable
public FindTypes GenerateFindExtensions { get; set; }
Property Value
GenerateIEquatable
Enables generation of IEquatable<T> interface implementation on entity classes with primary key.
- Default:
false
- In T4 compability mode:
false
public bool GenerateIEquatable { get; set; }
Property Value
GenerateInitDataContextMethod
Enables generation of InitDataContext partial method on data context class.
- Default:
true
- In T4 compability mode:
true
public bool GenerateInitDataContextMethod { get; set; }
Property Value
GenerateLength
Enables generation of database type length for entity column mapping.
- Default:
false
- In T4 compability mode:
false
public bool GenerateLength { get; set; }
Property Value
GeneratePrecision
Enables generation of database type precision for entity column mapping.
- Default:
false
- In T4 compability mode:
false
public bool GeneratePrecision { get; set; }
Property Value
GenerateProcedureAsync
Enables generation of async version of stored procedure mapping.
- Default:
true
- In T4 compability mode:
false
public bool GenerateProcedureAsync { get; set; }
Property Value
GenerateProcedureParameterDbType
Enables generation of database type name in stored procedure parameter mapping.
- Default:
false
- In T4 compability mode:
false
public bool GenerateProcedureParameterDbType { get; set; }
Property Value
GenerateProcedureResultAsList
When true
, stored procedure mapping use List<T> as return type.
Otherwise IEnumerable<T> type used.
- Default:
false
- In T4 compability mode:
false
public bool GenerateProcedureResultAsList { get; set; }
Property Value
GenerateProcedureSync
Enables generation of sync version of stored procedure mapping.
- Default:
true
- In T4 compability mode:
true
public bool GenerateProcedureSync { get; set; }
Property Value
GenerateProceduresSchemaError
Enables generation of error if stored procedure or table function schema load failed.
- Default:
false
- In T4 compability mode:
false
public bool GenerateProceduresSchemaError { get; set; }
Property Value
GenerateScale
Enables generation of database type scale for entity column mapping.
- Default:
false
- In T4 compability mode:
false
public bool GenerateScale { get; set; }
Property Value
GenerateSchemaAsType
Enables generation of context for entities and procedures/functions from non-default schemas in separate context-like class.
- Default:
true
- In T4 compability mode:
false
public bool GenerateSchemaAsType { get; set; }
Property Value
HasConfigurationConstructor
Enables generation of data context constructor with (string configurationName)
parameter.
- Default:
true
- In T4 compability mode:
true
public bool HasConfigurationConstructor { get; set; }
Property Value
HasDefaultConstructor
Enables generation of default data context constructor.
- Default:
true
- In T4 compability mode:
true
public bool HasDefaultConstructor { get; set; }
Property Value
HasTypedOptionsConstructor
Enables generation of data context constructor with generic (DataOptions<T> options)
parameter,
where T
is generated data context class.
- Default:
true
- In T4 compability mode:
true
public bool HasTypedOptionsConstructor { get; set; }
Property Value
HasUntypedOptionsConstructor
Enables generation of data context constructor with non-generic (DataOptions options)
parameter.
- Default:
false
- In T4 compability mode:
true
public bool HasUntypedOptionsConstructor { get; set; }
Property Value
IncludeDatabaseInfo
Enables generation of comment with database information on data context class. Includes database name, data source and server version values if available from schema provider for current database.
- Default:
false
- In T4 compability mode:
false
public bool IncludeDatabaseInfo { get; set; }
Property Value
IncludeDatabaseName
Enables generation of Database name in mappings (for tables, views, procedures and functions).
- Default:
false
- In T4 compability mode:
false
public bool IncludeDatabaseName { get; set; }
Property Value
MapProcedureResultToEntity
Enables reuse of generated entity mapping class and stored procedure or table function return record type, when record mappings match known entity mappings (record has same set of columns by name and type including nullability as entity).
- Default:
true
- In T4 compability mode:
true
public bool MapProcedureResultToEntity { get; set; }
Property Value
Metadata
Specifies type of generated metadata source.
- Default: Attributes
- In T4 compability mode: Attributes
public MetadataSource Metadata { get; set; }
Property Value
OrderFindParametersByColumnOrdinal
Specifies order of primary key column parameters in Find method for entity with composite primary key.
- Default:
true
- In T4 compability mode:
false
public bool OrderFindParametersByColumnOrdinal { get; set; }
Property Value
ProcedureNameOptions
Gets or sets name generation and normalization rules for stored procedures and functions method names.
- Default: Pascal, SplitByUnderscore
- In T4 compability mode: Pascal, SplitByUnderscore
public NormalizationOptions ProcedureNameOptions { get; set; }
Property Value
ProcedureParameterNameOptions
Gets or sets name generation and normalization rules for stored procedures and functions method parameters.
- Default: CamelCase, SplitByUnderscore
- In T4 compability mode: CamelCase, SplitByUnderscore
public NormalizationOptions ProcedureParameterNameOptions { get; set; }
Property Value
ProcedureResultClassNameOptions
Gets or sets name generation and normalization rules for custom mapping class for result record of stored procedure or table function.
- Default: Pascal, SplitByUnderscore,
Suffix = "Result"
- In T4 compability mode: Pascal, SplitByUnderscore,
Suffix = "Result"
public NormalizationOptions ProcedureResultClassNameOptions { get; set; }
Property Value
ProcedureResultColumnPropertyNameOptions
Gets or sets name generation and normalization rules for column properties of custom mapping class for result record of stored procedure or table function.
- Default: Pascal, SplitByUnderscore
- In T4 compability mode: None, SplitByUnderscore, MaxUpperCaseWordLength=2
public NormalizationOptions ProcedureResultColumnPropertyNameOptions { get; set; }
Property Value
SchemaClassNameOptions
Gets or sets name generation and normalization rules for wrapper class for non-default schema (when GenerateSchemaAsType option enabled).
- Default: Pascal, SplitByUnderscore,
Suffix = "Schema"
- In T4 compability mode: Pascal, SplitByUnderscore,
Suffix = "Schema"
public NormalizationOptions SchemaClassNameOptions { get; set; }
Property Value
SchemaMap
Provides base names for schema wrapper class and main data context property for additional schemas (when GenerateSchemaAsType option set).
- Default: empty
- In T4 compability mode: empty
public IDictionary<string, string> SchemaMap { get; }
Property Value
SchemaPropertyNameOptions
Gets or sets name generation and normalization rules for non-default schema data context class accessor property on main data context (when GenerateSchemaAsType option enabled).
- Default: Pascal, SplitByUnderscore
- In T4 compability mode: Pascal, SplitByUnderscore
public NormalizationOptions SchemaPropertyNameOptions { get; set; }
Property Value
SkipProceduresWithSchemaErrors
Skip generation of mappings for stored procedure, if it failed to load it's schema. Otherwise mapping will be generated, but procedure will have only parameters without return data sets. This option doesn't affect table functions with schema errors - for functions we skip them on error always, because table function must have return result set.
- Default:
false
- In T4 compability mode:
true
public bool SkipProceduresWithSchemaErrors { get; set; }
Property Value
SourceAssociationPropertyNameOptions
Gets or sets name generation and normalization rules for assocation from foreign key source entity side.
- Default: Pascal, Association
- In T4 compability mode: Pascal, Association
public NormalizationOptions SourceAssociationPropertyNameOptions { get; set; }
Property Value
TableFunctionMethodInfoFieldNameOptions
Gets or sets name generation and normalization rules for field to store MethodInfo for table function mapping method.
- Default: CamelCase, SplitByUnderscore,
Prefix = "_"
- In T4 compability mode: CamelCase, SplitByUnderscore,
Prefix = "_"
public NormalizationOptions TableFunctionMethodInfoFieldNameOptions { get; set; }
Property Value
TableFunctionReturnsTable
When true
, table function mapping use ITable<T> as return type.
Otherwise IQueryable<T> type used.
- Default:
false
- In T4 compability mode:
true
public bool TableFunctionReturnsTable { get; set; }
Property Value
TargetMultipleAssociationPropertyNameOptions
Gets or sets name generation and normalization rules for assocation from foreign key target entity side with multiple cardinality.
- Default: Pascal, Association, PluralIfLongerThanOne
- In T4 compability mode: Pascal, Association, PluralIfLongerThanOne
public NormalizationOptions TargetMultipleAssociationPropertyNameOptions { get; set; }
Property Value
TargetSingularAssociationPropertyNameOptions
Gets or sets name generation and normalization rules for assocation from foreign key target entity side with singular cardinality.
- Default: Pascal, Association
- In T4 compability mode: Pascal, Association
public NormalizationOptions TargetSingularAssociationPropertyNameOptions { get; set; }