Advanced

On this tab you can set special rules for generating default names of database objects to be applied in various cases of the Model First approach usage. When setting these rules, you can use predefined keywords which will be replaced with the corresponding values.

Primary Key Column

Defines special naming rules for primary key columns. Predefined keywords, which will be replaced with corresponding values are: %entity name%, %property name%.

%entity name%

Name of the entity, containing the simple type property, the column is generated for.

%property name%

Name of the entity key property, the column is generated for.

Foreign Key Column

Defines special naming rules for foreign key columns. Predefined keywords, which will be replaced with corresponding values are: %entity name%, %master entity name%, %master property name%, %master column name% .

%entity name%

Name of the dependent entity.

%master entity name%

Name of the master entity, the foreign key refers to.

%master property name%

Name of the entity key property of the master entity, the foreign refers to.

%master column name%

Name of the column, the corresponding entity key property of the foreign key master entity is mapped to.

Complex Type Property Columns

Defines special naming rules for generating column names that correspond to complex type's properties. Predefined keywords, which will be replaced with corresponding values are: %property name%, %parent property prefix%, %parent property name%, %complex type name%.

%property name%

Name of the simple type property, belonging to the complex type.

%parent property prefix%

If the parent property name contains the complex type name, then this keyword returns the fragment of the parent property name that precedes the complex type name occurrence in the parent property name. Otherwise, an empty string is substituted for this keyword.

%parent property name%

Name of the complex type property, containing the simple type property, the column is generated for.

%complex type name%

Name of the complex type.

Primary Key Column for TPT Inheritance

Defines special naming rules for discriminator columns for TPT inheritances. Predefined keywords, which will be replaced with corresponding values are: %entity name%, %base entity name%, %base property name%.

%entity name%

Name of the entity, containing the simple type property, the column is generated for.

%base entity name%

Name of the base entity of the TPT hierarchy.

%base property name%

Name of the entity key of the base entity of the TPT hierarchy.

Discriminator Column for TPH Inheritance

Defines special naming rules for discriminator columns for TPH inheritances. Predefined keywords, which will be replaced with corresponding values are: %base entity name%.

%base entity name%

Name of the base entity of the TPH hierarchy.

 

ExpandedToggleIconHow Special Rules Work

Example 1

Suppose, that the default value of the Primary Key Column special rule is changed to %property name%ID.

This means, that if we add a new entity key to a class, and call it, for example, Employee, the corresponding automatically generated name of the table column will be EmployeeID.

Example 2

Suppose, we have a model containing the Address complex type with the City and PostalCode properties, and the Employee class with a set of properties including the ShipAddress complex type property.

As the Complex Type Property Columns special rule is set to %parent property prefix% %property name%, the names for database columns corresponding to the Address complex type properties are automatically generated equal to ShipCity and ShipPostalCode, since Ship is actually a prefix. Thus, the Employees table contains a set of columns including ShipCity and ShipPostalCode.  

 

 


Send feedback on this topic

© 2008 - 2024 Devart. All rights reserved.