Database Column Mapping

This section describes some of the parameters of columns that the user can define when setting up the properties of entities in Entity Developer.

The Column Editor dialog is accessible through the three-dotted button on the right side of the Column field or by pressing Alt+E keys in the following dialog boxes:

Class Editor;
Complex Type Editor;
Inheritance Editor;
Property Editor.

You can define the following parameters in the Column Editor dialog (see below):

Images_ColumnEditorNewEFC

 

ExpandedToggleIcon        Mapping

The Mapping drop-down list allows setting the property mapping type to the column. The value of this field for scalar properties is set to Custom mapping and cannot be changed. For properties of component type properties one of the following values can be selected: Custom mapping, Default mapping and No mapping. For example, you can select mapping when you open a class editor and click the three-dotted button on the right side of the Column field for a property, that is contained in a complex type property.

Custom mapping allows specifying custom column names for property mapping. Additionally, custom mapping allows specifying a prefix to be added to all component type properties as well as to exclude one or more properties from being mapped.

Default mapping is set for every property participating in a component. There are two main approaches to defining default mapping. You can either leave the column name suggested by the application in accordance with the naming rules defined in the model settings or enter a different name for each column.

No mapping option allows excluding a property from mapping.

See the Complex Type Mapping topic for more information.

 

ExpandedToggleIcon        Column Name

By default, the name of the column is identical to the name of the corresponding property and follows the requirements defined in the naming sections of the Model Settings dialog. If at some stage of model development the naming rules and/or the name of the corresponding property is changed for any reason, the default column name will be changed accordingly.

However, the user can set a custom name for the column by entering it in the Column Name field. Additionally, it is possible to prohibit the use of null values in a column (by selecting the Not Null check box) and to create a unique key constraint on a column (by selecting the Unique check box).

note Note

If the value of the Not Null check box is not specified explicitly, as displayed on the screenshot above, its value will be calculated depending on the Nullable property value for the corresponding property.

 

ExpandedToggleIcon        Data Type Parameters

The Column Editor dialog also enables the user to make optional adjustments of the column data type.

The SQL Type field can be used to specify the type of the column that is to be created in the database. If this parameter is specified, the Fixed Length and Unicode check boxes become unavailable.

The Fixed Length check box can be used to specify that the column stores fixed-length data for CHAR, BIT or BINARY data types on the server side. CHAR/BINARY column is created instead of VARCHAR/VARBINARY.

The Unicode check box can be used, for example, to specify that the string data type in the model is to be matched with the NCHAR or NVARCHAR types in the database.

note Note

If the value of the Unicode check box is not specified explicitly, its value will be calculated depending on  the Default Unicode property value from the model property set. This value is displayed for this field.

The Length field can be used to set the maximal length for values of character or binary data types (such as CHAR, VARCHAR, BINARY, VARBINARY, BIT etc.) on the server side.

note Note

If the value of the Length field is not specified explicitly, its value will be calculated depending on  the Default Length property value from the model property set.

The Precision and Scale fields can be used to specify the exact parameters of numeric values, for example, of the DECIMAL type in Oracle. The Precision field is used to specify the number of places before the decimal point, while the Scale field can be used to specify the number of places after the decimal point.

note Note

If the values of the Precision and Scale fields are not specified explicitly, their values will be calculated depending on the Default Precision and Default Scale property values from the model property set.

The Default Value field can be used to specify the value which will be used during generation of the database creation script by the NHibernate run-time or Entity Developer itself and inserted into the database column.

The Unique Key field can be used to specify the name of a unique constraint, which will include the column and will be taken into account during generation of the database creation script by the NHibernate run-time or Entity Developer itself.

 

ExpandedToggleIcon        See Also


Send feedback on this topic

© 2008 - 2024 Devart. All rights reserved.