Поделиться через


GetterAccess and SetterAccess Attributes (CSDL)

In the Entity Data Model (EDM), the GetterAccess and SetterAccess attributes of a Property element specify the access assigned to the property when an instance of the type is created.

The following example shows public GetterAccess and private SetterAccess for the property ContactName.

<EntityType Name="CCustomer">
          <Key>
            <PropertyRef Name="CustomerId" />
          </Key>
          <Property Name="CustomerId" Type="Int32" Nullable="false" />
          <Property Name="CompanyName" Type="String" />
          <Property Name="ContactName" Type="String" 
                    a:GetterAccess="Public" 
                    a:SetterAccess="Private" 
 xmlns:a="https://schemas.microsoft.com/ado/2006/04/codegeneration"/>
          <Property Name="ContactTitle" Type="String" />
          <Property Name="Address" Type="Self.CAddress" Nullable="false" />
        </EntityType>

Note

These attributes are not technically part of CSDL, but they are included in a CSDL file using annotations XSD extensibility feature called anyAttribute.

See Also

Concepts

Entity Type (EDM)