In This Topic
dotConnect for DB2 includes settings for configuring DDL generation in Entity Framework Code First. The following settings are available.
RemoveSchemaFromDefaultConstraintName - When set to true, the schema (database) name prefix is removed from default constraint names (primary keys, foreign keys) generated by Code-First Migrations. Default value is true.
- AddTableNameInDefaultIndexName - When set to true, the table name is added to default index name generated by Code-First Migrations (like 'IX_TableName_ColumnName').
When set to false, then default index names will be like 'IX_ColumnName'.
Default value is true.
- TruncateLongDefaultNames - When set to true, long default names of indexes, primary keys, and foreign keys,
generated by Code-First Migrations, will be truncated and renamed if they exceed the limit of 128 characters.
When set to false, an exception will be raised for long default names generated by Code-First Migrations if they are too long.
This option does not affect the truncation of long default names generated by Code-First CreateDatabase() and DropDatabase() functionality.
They are always truncated if they exceed the limit of 128 characters.
However it affects the algorithm of this truncation and renaming of these identifiers.
When it is set to true, the names of these identifiers are identical both in Code-First CreateDatabase() and in Code-First Migrations.
Default value is true.
UseNonUnicodeStrings - When set to true, string properties without explicitly specified server data type will be treated as non-unicode. Default value is false.
By default, Entity Framework considers all the string properties as Unicode and maps them to NCHAR, NVARCHAR, and NCLOB columns depending on other property parameters when creating/updating database structure. If you want to use CHAR, VARCHAR2, and CLOB columns for string properties by default, set this option to true.
UseNonLobStrings - When set to true, string properties without explicitly specified server data type will be treated as non-LOBs. Default value is false.
- UseDateTimeAsDate - When set to true, DateTime properties without as explicitly specified server data type will be treated as DATE. Default value is false.
These options can be set either in code as the properties of the EntityProviderConfig.CodeFirstOptions object or in the project config file as the attributes of the CodeFirstOptions element of the Devart.Data.DB2.Entity tag.