Schema 要素 (CSDL)
Schema 要素は、エンティティ データ モデル (EDM) の概念スキーマのルート要素です。Schema 要素は、定義対象のオブジェクト モデルによって使用されるエンティティおよびアソシエーションを含む Namespace のスキーマです。概念スキーマは、概念スキーマ定義言語 (CSDL) で定義されます。概念スキーマ内の EntityType 要素と Association 要素は、Schema 要素の子要素です。
EntityContainer 要素は、設計対象のオブジェクト モデル内のクラスのスキーマです。EntitySet と AssociationSet は EntityContainer の子要素です。
EntityType 要素および Association 要素の詳細については、このセクションの各サブトピックを参照してください。EntityContainer 要素の詳細については、「EntityContainer 要素 (CSDL)」を参照してください。
次のスキーマ宣言は、Schema 要素とその子要素を示しています。
<Schema Namespace="AdventureWorksHRModel" Alias="Self"
xmlns="https://schemas.microsoft.com/ado/2006/04/edm">
<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" />
<Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
</EntityType>
<EntityType Name="Employee"
<Key>
<PropertyRef Name=EmployeeID>
</Key>
<Property Name="EmployeeID" Type="Int32" Nullable="false" />
<Property Name="NationalIDNumber" Type="String" Nullable="false" />
<Property Name="ContactID" Type="Int32" Nullable="false" />
<Property Name="LoginID" Type="String" Nullable="false"/>
<Property Name="Title" Type="String" Nullable="false" />
<Property Name="BirthDate" Type="DateTime" Nullable="false" />
<Property Name="MaritalStatus" Type="String" Nullable="false"
/>
<Property Name="Gender" Type="String" Nullable="false"/>
<Property Name="HireDate" Type="DateTime" Nullable="false" />
<Property Name="SalariedFlag" Type="Boolean" Nullable="false" />
<Property Name="VacationHours" Type="Int16" Nullable="false" />
<Property Name="SickLeaveHours" Type="Int16" Nullable="false" />
<Property Name="CurrentFlag" Type="Boolean" Nullable="false" />
<Property Name="rowguid" Type="Guid" Nullable="false" />
<Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
</EntityType>
<Association Name="Employee_EmployeeManagerID">
<End Role="Employee" Type="Self.Employee" Multiplicity="0..1" />
<End Role="Employee" Type="Self.Employee" Multiplicity="0..*" />
</Association>
<EntityContainer Name="HumanResources">
<EntitySet Name="Department" EntityType="Self.Department" />
<EntitySet Name="Employee" EntityType="Self.Employee" />
<AssociationSet Name="Employee_EmployeeManagerID"
Association="Self.Employee_EmployeeManagerID">
<End Role="Employee" EntitySet="Employee" />
<End Role="Employee63" EntitySet="Employee" />
</AssociationSet>
</EntityContainer>
</Schema>
CSDL スキーマ仕様は、マッピング スキーマ言語 (MSL) のストア スキーマ定義言語 (SSDL) 仕様にマップされます。
このセクションのトピック
このセクションの各トピックでは、EDM 上に構築されるオブジェクト モデルの実装に使用する型および要素について説明します。Schema 要素の Namespace 属性と、Schema 要素の子要素 (EntityType や Association など) については、次のトピックで説明します。
これらの型にはそれぞれ、CSDL スキーマに子要素があります。
参照
概念
EntityContainer 要素 (CSDL)
エンティティの実装 (EDM)
アソシエーションの実装 (EDM)