共用方式為


GetterAccess 和 SetterAccess 屬性 (CSDL)

在 實體資料模型 (EDM) 中,Property 項目的 GetterAccessSetterAccess 屬性 (Attribute) 會指定當建立此型別的執行個體 (Instance) 時,指派給此屬性 (Property) 的存取權。

下列範例會顯示 ContactName 屬性的公用 (Public) GetterAccess 和私用 (Private) SetterAccess

<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附註

雖然這些屬性在技術上不屬於 CSDL 的一部分,但是它們會使用稱為 anyAttribute 的附註 XSD 擴充功能包含在 CSDL 檔案中。

另請參閱

概念

實體類型 (EDM)