Partilhar via


Property Element (SSDL)

The Property element in store schema definition language (SSDL) represents a column in a table in the underlying database. Property elements are children of EntityType elements, which represent rows in a table. Each Property element defined on an EntityType element represents a column.

A Property element cannot have any child elements.

Applicable Attributes

The following table describes the attributes that can be applied to the Property element.

Attribute Name Is Required Value

Name

Yes

The name of the corresponding column.

Type

Yes

The type of the corresponding column.

Nullable

No

True (the default value) or False depending on whether the corresponding column can have a null value.

DefaultValue

No

The default value of the corresponding column.

MaxLength

No

The maximum length of the corresponding column.

FixedLength

No

True or False depending on whether the corresponding column value will be stored as a fixed length string.

Precision

No

The precision of the corresponding column.

Scale

No

The scale of the corresponding column.

Unicode

No

True or False depending on whether the corresponding column value will be stored as a Unicode string.

Collation

No

A string that specifies the collating sequence to be used in the data source.

StoreGeneratedPattern

No

None, Identity (if the corresponding column value is an identity that is generated in the database), or Computed (if the corresponding column value is computed in the database).

Note

Any number of annotation attributes (custom XML attributes) may be applied to the Property element. However, custom attributes may not belong to any XML namespace that is reserved for SSDL. The fully-qualified names for any two custom attributes cannot be the same.

Example

The following example shows an EntityType element with two child Property elements:

<EntityType Name="Customers">
  <Documentation>
    <Summary>Summary here.</Summary>
    <LongDescription>Long description here.</LongDescription>
  </Documentation>
  <Key>
    <PropertyRef Name="CustomerId" />
  </Key>
  <Property Name="CustomerId" Type="int" Nullable="false" />
  <Property Name="Name" Type="nvarchar(max)" Nullable="false" />
</EntityType>

See Also

Concepts

Entity Framework Overview
SSDL Specification

Other Resources

CSDL, SSDL, and MSL Specifications
ADO.NET Entity Data Model Tools