Click or drag to resize
DataMapperRegisterMapping Method
Registers a new mapping of type to Azure Search DataType along with a function for conversion of source values to target values directly assignable to Azure Search API.

Namespace: CMS.Search.Azure
Assembly: CMS.Search.Azure (in CMS.Search.Azure.dll) Version: 12.0.0
Syntax
C#
public void RegisterMapping(
	Type type,
	DataType mappedDataType,
	Func<Object, Object> conversion = null
)

Parameters

type
Type: SystemType
Type for which to register the mapping.
mappedDataType
Type: DataType
Azure Search data type to be used for storing values of type type.
conversion (Optional)
Type: SystemFuncObject, Object
Function converting source value to value of type which is directly assignable to Azure Search API. Leave null to keep the value as is.
Remarks

Some types like Int32 or String are directly assignable to Azure Search. On the contrary Guid is explicitly converted to a string as the default mapping stores Guid as a String.

In order to avoid unexpected behavior while performing implicit conversions by the Azure Search API, it is recommended to always provide a conversion function.

See Also