facet (Entity Data Model)

A facet is used to add detail to a primitive type property definition. A property definition contains information about the property type, but often more detail is necessary. For example, an entity type in a conceptual model might have a property of type String whose value cannot be set to null. Facets allow you to specify this level of detail.

The table below describes the facets that are supported in the EDM.


The exact values and behaviors of facets are determined by the run-time environment that uses an EDM implementation.



Applies to


Specifies the collating sequence (or sorting sequence) to be used when performing comparison and ordering operations on values of the property.



Indicates that the value of the property should be used for optimistic concurrency checks.

All primitive type properties


Specifies the default value of the property if no value is supplied upon instantiation.

All primitive type properties


Specifies whether the length of the property value can vary.

Binary, String


Specifies the maximum length of the property value.

Binary, String


Specifies whether the property can have a null value.

All primitive type properties


For properties of type Decimal, specifies the number of digits a property value can have. For properties of type Time, DateTime, and DateTimeOffset, specifies the number of digits for the fractional part of seconds of the property value.

DateTime, DateTimeOffset, Decimal, Time,


Specifies the number of digits to the right of the decimal point for the property value.



Indicates whether the property value is stored as Unicode.



The ADO.NET Entity Framework uses a domain-specific language (DSL) called conceptual schema definition language (CSDL) to define conceptual models. The following CSDL defines a Book entity type. Note that facets are implemented as XML attributes. The facet values indicate that no property can be set to null, and that the Scale and Precision of the Revision property are each set to 29.

<EntityType Name="Book">
    <PropertyRef Name="ISBN" />
  <Property Type="String" Name="ISBN" Nullable="false" />
  <Property Type="String" Name="Title" Nullable="false" />
  <Property Type="Decimal" Name="Revision" Nullable="false" Precision="29" Scale="29" />
  <NavigationProperty Name="Publisher" Relationship="BooksModel.PublishedBy"
                      FromRole="Book" ToRole="Publisher" />
  <NavigationProperty Name="Authors" Relationship="BooksModel.WrittenBy"
                      FromRole="Book" ToRole="Author" />

See Also


Entity Data Model Key Concepts

Entity Data Model