Dictionary Property Mapping - Overview
This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.
This section provides examples of how to map dictionary properties. Fluent Mapping API exposes the following extension methods from the Telerik.OpenAccess.Metadata.Fluent.Advanced namespace for mapping a dictionary where both the key and the value are primitive CLR types:
Dictionary Key configuration:
- WithKeyColumn(string columnName) - allows you to specify the name of the column to which the dictionary key will be mapped.
- WithKeyOpenAccessType(OpenAccessType columnType) - allows you to specify the Telerik Data Access type of the column to which the dictionary key will be mapped. With this method you can specify the column type independently from the actual backend.
- HasKeyColumnType(string columnSQLType) - allows you to specify the SQL type of the column to which the dictionary key will be mapped. Note that the argument passed to this method would vary depending on the backend in use.
- HasKeyPrecision(int precision) - allows you to specify the precision of the column to which the dictionary key will be mapped.
- HasKeyScale(int scale) - allows you to specify the scale of the column to which the dictionary key will be mapped.
- HasKeyLength(int length) - allows you to specify the length of the column to which the dictionary key will be mapped.
- WithDictionaryKey(string columnName, string columnType) - allows you to specify the name and SQL type of the column to which the dictionary key will be mapped. This method has been deprecated, please use WithDictionaryKey(string columnName) and WithKeyOpenAccessType(OpenAccessType columnType) instead.
Dictionary Value configuration:
- WithValueColumn(string columnName) - allows you to specify the name of the column to which the dictionary value will be mapped.
- WithValueOpenAccessType(OpenAccessType columnType) - allows you to specify the Telerik Data Access type of the column to which the dictionary value will be mapped. With this method you can specify the column type independently from the actual backend.
- HasValueColumnType(string columnSQLType) - allows you to specify the SQL type of the column to which the dictionary value will be mapped. Note that the argument passed to this method would vary depending on the backend in use.
- HasValuePrecision(int precision) - allows you to specify the precision of the column to which the dictionary value will be mapped.
- HasValueScale(int scale) - allows you to specify the scale of the column to which the dictionary value will be mapped.
- HasValueLength(int length) - allows you to specify the length of the column to which the dictionary value will be mapped.
- WithValueInfinityLength() - allows you to specify that the column to which the value of the dictionary is mapped should have infinite length. This method should be used only when the value of the dictionary is of type string.
- WithDictionaryValue(string columnName, string columnType) - allows you to specify the name and SQL type of the column to which the dictionary value will be mapped. This method has been deprecated, please use WithDictionaryValue(string columnName) and WithValueOpenAccessType(OpenAccessType columnType) instead.
Table configuration:
- WithForeignKey(string columnName) - allows you to specify the name of the foreign key column.
- WithTable(TableName tableName) - allows you to specify the name of the table to which the dictionary will be mapped.
All extension methods for configuring of dictionary properties are located in the Telerik.OpenAccess.Metadata.Fluent.Advanced namespace.
In this section: