This topic demonstrates how to describe string properties in backend independent manner. The Fluent Mapping API exposes the following methods that allow you to map string properties in an abstract way:

WithFixedLength - specifies that the string property should be mapped using fixed length. This will map the property to a CHAR(n) or NCHAR(n) column, depending on the encoding.

WithVariableLength - specifies that the string property should be mapped using variable length. This will map the property to a VARCHAR(n) or NVARCHAR(n) column, depending on the encoding.

WithInfiniteLength - specifies that the string property should be mapped using infinite length. This will map the property to a VARCHAR(MAX) or NVARCHAR(MAX) column, depending on the encoding.

IsUnicode - specifies that the string property should be mapped to a unicode column.

IsNotUnicode - specifies that the string property should be mapped to a non-unicode column.

Using a combination of methods will allow you to get all of the possible types that map a string.

The following example demonstrates how to map the string properties of the Product class using the Backend Independent API.

Product Class

Public Class Product
Private _iD As Integer
Public Property ID() As Integer
Get
Return _iD
End Get
Set(ByVal value As Integer)
_iD = value
End Set
End Property
Private _productName As String
Public Property ProductName() As String
Get
Return _productName
End Get
Set(ByVal value As String)
_productName = value
End Set
End Property
Private _description As String
Public Property Description() As String
Get
Return _description
End Get
Set(ByVal value As String)
_description = value
End Set
End Property
Private _comments As String
Public Property Comments() As String
Get
Return _description
End Get
Set(ByVal value As String)
_comments = value
End Set
End Property
End Class