Condividi tramite


Attributo Default (EntityType CSDL)

In Entity Data Model (EDM) l'attributo Default di un elemento Property specifica il valore assegnato alla proprietà quando viene creata un'istanza del tipo.

La definizione seguente dell'entità Department include quattro elementi Property. Ogni proprietà dispone di un attributo Type che utilizza un tipo di dati assegnato. La proprietà GroupName include, ad esempio, l'assegnazione Default "New Hire".

  <EntityType Name="Department" >
    <Key>
        <PropertyRef Name="DepartmentID">
    </Key>
    <Property Name="DepartmentID" Type="Int16" Nullable="false" />
    <Property Name="Name" Type="String" Nullable="false" />
    <Property Name="GroupName" Type="String" Nullable="false" Default="New Hire" />
    <Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
  </EntityType>

Vedere anche

Concetti

Attributo Default (EntityType SSDL)