String (EDM)

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

The String type represents fixed or variable length character data and maps to nvarchar in SQL Server.


The Edm.String type MaxLength="512" cannot be mapped to SqlServer.ntext even though the ntext can be explicitly cast to nvarchar(512) or from nvarchar(512) to ntext. Mapping is restricted to types that match without the cast.


The String type supports EDM simple type facets of Unicode, Collation, FixedLength, and MaxLength..

The Unicode facet is a Boolean value. When set to true this value dictates that the string stores Unicode characters; otherwise, the string stores standard ASCII encoding. The default value for this facet is true.


You can't choose the kind of Unicode by using the EDM Unicode facet; the type systems that host the EDM determine the appropriate kind of Unicode.

The FixedLength facet is a Boolean value. The value indicates whether the data source requires a String to be fixed length or not (In SQL Server, this would mean that the String represents a char or nchar data type instead of varchar or nvarchar).

The MaxLength facet specifies the maximum length of an instance of the string type. When the Unicode facet is true, the MaxLength can range from 1 to 230. Otherwise the value can range from 1 to 231.


You can use a sentinel value of Max, which indicates that this property is the maximum length supported by the data source.

The Collation facet is a String value that specifies the collating sequence, or sorting sequence, to be used for performing comparison and ordering operations over String values.