Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

StoreGeneratedPattern Attribute (SSDL)

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

In the Entity Data Model (EDM), the store schema definition language (SSDL) file defines a computed property using the attribute StoreGeneratedPattern. StoreGeneratedPattern="Computed" signals the update pipeline to retrieve the value from storage rather than setting it. The property must be computed from values in storage.


This attribute is not currently generated by Edmgen.exe and must be added manually.

In the following SSDL schema, the properties TotalDue and ModifiedDate are attributed as store-generated.

  <EntityType Name="SalesOrderHeader">
      <PropertyRef Name="SalesOrderID" />
    <Property Name="SalesOrderID" Type="int" Nullable="false" 
              StoreGeneratedPattern="Identity" />
    <!-- Other properties -->
    <Property Name="CurrencyRateID" Type="int" />
    <Property Name="SubTotal" Type="money" Nullable="false" />
    <Property Name="TaxAmt" Type="money" Nullable="false" />
    <Property Name="Freight" Type="money" Nullable="false" />
    <Property Name="TotalDue" Type="money" Nullable="false"
    <Property Name="ModifiedDate" Type="datetime" Nullable="false"

Possible values for StoreGeneratedPattern

The possible values for the StoreGeneratedProperty are:

  • Identity

  • Computed

  • None

Setting the StoreGeneratedPattern attribute on a column to Identity or Computed forces the value for the column to be retrieved from the server as an Identity or Computed value when you call SaveChanges. Identity properties are read from the data source when the type is first saved, but afterward, they are assumed to be unchanged. Computed properties are read every time SaveChanges is called. The property is not set in the data source when you save the entity.

Setting the StoreGeneratedPattern attribute to None is the same as not adding the attribute at all, and the value is not retrieved from the server on calling SaveChanges.

There are some scenarios when you might want to manually add or edit a StoreGeneratedPattern attribute. For example, you can use this attribute to make a column read-only. You can also use it to enable automatic synchronization: every time an entity is written to the data source, the computed column will be refreshed from the data source to the entity.

To manually add or edit a StoreGeneratedPattern attribute, add or edit the attribute in the SSDL Property element that corresponds to the targeted column.

See Also