在 实体数据模型 (EDM) 中,Property 元素的 GetterAccess 和 SetterAccess 属性指定创建类型的实例时为属性分配的访问权限。
下面的示例演示属性 ContactName
的公共 GetterAccess 和私有 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>
![]() |
---|
这些属性在技术上不是 CSDL 的一部分,但它们通过名为 anyAttribute 的批注 XSD 扩展功能包含在 CSDL 文件中。 |