AdventureWorks Sales 개념 스키마(EDM)
AdventureWorks Sales 모델은 SQL Server와 함께 제공되는 AdventureWorks 샘플의 테이블을 기반으로 한 EDM(엔터티 데이터 모델) 구현입니다. 5개의 엔터티가 선언됩니다.
Address
Contact
Product
SalesOrderDetail
SalesOrderHeader
이 형식의 인스턴스는 개념 스키마를 기반으로 빌드된 개체 모델에서 이름이 동일한 엔터티 집합에 의해 논리적으로 포함되었습니다.
3개의 연결 및 연결 집합이 선언됩니다. 다음 연결의 이름은 모두 **FK_**로 시작됩니다. 이는 Adventure Works 데이터의 테이블에 있는 외래 키 관계를 나타냅니다.
FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID
FK_SalesOrderHeader_Address_ShipToAddressID
FK_SalesOrderHeader_Contact_ContactID
CSDL 스키마
이 모델의 엔터티 및 연결은 CSDL(개념 스키마 정의 언어)로 선언되고 정의됩니다. 전체 스키마는 다음 예제에 나와 있습니다.
<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="AdvWrksSalesModel" Alias="Self" xmlns="https://schemas.microsoft.com/ado/2006/04/edm">
<EntityContainer Name="AdvWksSalesEntities">
<EntitySet Name="Address" EntityType="AdvWrksSalesModel.Address" />
<EntitySet Name="Contact" EntityType="AdvWrksSalesModel.Contact" />
<EntitySet Name="Product" EntityType="AdvWrksSalesModel.Product" />
<EntitySet Name="SalesOrderDetail" EntityType="AdvWrksSalesModel.SalesOrderDetail" />
<EntitySet Name="SalesOrderHeader" EntityType="AdvWrksSalesModel.SalesOrderHeader" />
<AssociationSet Name="FK_SalesOrderHeader_Address_BillToAddressID" Association="AdvWrksSalesModel.FK_SalesOrderHeader_Address_BillToAddressID">
<End Role="Address" EntitySet="Address" />
<End Role="SalesOrderHeader" EntitySet="SalesOrderHeader" />
</AssociationSet>
<AssociationSet Name="FK_SalesOrderHeader_Address_ShipToAddressID"
Association="AdvWrksSalesModel.FK_SalesOrderHeader_Address_ShipToAddressID">
<End Role="Address" EntitySet="Address" />
<End Role="SalesOrderHeader" EntitySet="SalesOrderHeader" />
</AssociationSet>
<AssociationSet Name="FK_SalesOrderHeader_Contact_ContactID"
Association="AdvWrksSalesModel.FK_SalesOrderHeader_Contact_ContactID">
<End Role="Contact" EntitySet="Contact" />
<End Role="SalesOrderHeader" EntitySet="SalesOrderHeader" />
</AssociationSet>
<AssociationSet Name="FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID"
Association="AdvWrksSalesModel.FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID">
<End Role="SalesOrderHeader" EntitySet="SalesOrderHeader" />
<End Role="SalesOrderDetail" EntitySet="SalesOrderDetail" />
</AssociationSet>
</EntityContainer>
<EntityType Name="Address">
<Key>
<PropertyRef Name="AddressID" />
</Key>
<Property Name="AddressID" Type="Int32" Nullable="false" />
<Property Name="AddressLine1" Type="String" Nullable="false" />
<Property Name="AddressLine2" Type="String" />
<Property Name="City" Type="String" Nullable="false" />
<Property Name="StateProvinceID" Type="Int32" Nullable="false" />
<Property Name="PostalCode" Type="String" Nullable="false" />
<Property Name="rowguid" Type="Guid" Nullable="false" />
<Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
<NavigationProperty Name="SalesOrderHeader" Relationship="AdvWrksSalesModel.FK_SalesOrderHeader_Address_BillToAddressID"
FromRole="Address" ToRole="SalesOrderHeader" />
<NavigationProperty Name="SalesOrderHeader1" Relationship="AdvWrksSalesModel.FK_SalesOrderHeader_Address_ShipToAddressID"
FromRole="Address" ToRole="SalesOrderHeader" />
</EntityType>
<EntityType Name="Contact">
<Key>
<PropertyRef Name="ContactID" />
</Key>
<Property Name="ContactID" Type="Int32" Nullable="false" />
<Property Name="NameStyle" Type="Boolean" Nullable="false" />
<Property Name="Title" Type="String" />
<Property Name="FirstName" Type="String" Nullable="false" />
<Property Name="MiddleName" Type="String" />
<Property Name="LastName" Type="String" Nullable="false" />
<Property Name="Suffix" Type="String" />
<Property Name="EmailAddress" Type="String" />
<Property Name="EmailPromotion" Type="Int32" Nullable="false" />
<Property Name="Phone" Type="String" />
<Property Name="PasswordHash" Type="String" Nullable="false" />
<Property Name="PasswordSalt" Type="String" Nullable="false" />
<Property Name="AdditionalContactInfo" Type="String" />
<Property Name="rowguid" Type="Guid" Nullable="false" />
<Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
<NavigationProperty Name="SalesOrderHeader" Relationship="AdvWrksSalesModel.FK_SalesOrderHeader_Contact_ContactID"
FromRole="Contact" ToRole="SalesOrderHeader" />
</EntityType>
<EntityType Name="Product">
<Key>
<PropertyRef Name="ProductID" />
</Key>
<Property Name="ProductID" Type="Int32" Nullable="false" />
<Property Name="Name" Type="String" Nullable="false" />
<Property Name="ProductNumber" Type="String" Nullable="false" />
<Property Name="MakeFlag" Type="Boolean" Nullable="false" />
<Property Name="FinishedGoodsFlag" Type="Boolean" Nullable="false" />
<Property Name="Color" Type="String" />
<Property Name="SafetyStockLevel" Type="Int16" Nullable="false" />
<Property Name="ReorderPoint" Type="Int16" Nullable="false" />
<Property Name="StandardCost" Type="Decimal" Nullable="false" />
<Property Name="ListPrice" Type="Decimal" Nullable="false" />
<Property Name="Size" Type="String" />
<Property Name="SizeUnitMeasureCode" Type="String" />
<Property Name="WeightUnitMeasureCode" Type="String" />
<Property Name="Weight" Type="Decimal" />
<Property Name="DaysToManufacture" Type="Int32" Nullable="false" />
<Property Name="ProductLine" Type="String" />
<Property Name="Class" Type="String" />
<Property Name="Style" Type="String" />
<Property Name="ProductSubcategoryID" Type="Int32" />
<Property Name="ProductModelID" Type="Int32" />
<Property Name="SellStartDate" Type="DateTime" Nullable="false" />
<Property Name="SellEndDate" Type="DateTime" />
<Property Name="DiscontinuedDate" Type="DateTime" />
<Property Name="rowguid" Type="Guid" Nullable="false" />
<Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
</EntityType>
<EntityType Name="SalesOrderDetail">
<Key>
<PropertyRef Name="SalesOrderID" />
<PropertyRef Name="SalesOrderDetailID" />
</Key>
<Property Name="SalesOrderID" Type="Int32" Nullable="false" />
<Property Name="SalesOrderDetailID" Type="Int32" Nullable="false" />
<Property Name="CarrierTrackingNumber" Type="String" />
<Property Name="OrderQty" Type="Int16" Nullable="false" />
<Property Name="ProductID" Type="Int32" Nullable="false" />
<Property Name="SpecialOfferID" Type="Int32" Nullable="false" />
<Property Name="UnitPrice" Type="Decimal" Nullable="false" />
<Property Name="UnitPriceDiscount" Type="Decimal" Nullable="false" />
<Property Name="LineTotal" Type="Decimal" Nullable="false" />
<Property Name="rowguid" Type="Guid" Nullable="false" />
<Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
<NavigationProperty Name="SalesOrderHeader" Relationship="AdvWrksSalesModel.FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID"
FromRole="SalesOrderDetail" ToRole="SalesOrderHeader" />
</EntityType>
<EntityType Name="SalesOrderHeader">
<Key>
<PropertyRef Name="SalesOrderID" />
</Key>
<Property Name="SalesOrderID" Type="Int32" Nullable="false" />
<Property Name="RevisionNumber" Type="Byte" Nullable="false" />
<Property Name="OrderDate" Type="DateTime" Nullable="false" />
<Property Name="DueDate" Type="DateTime" Nullable="false" />
<Property Name="ShipDate" Type="DateTime" />
<Property Name="Status" Type="Byte" Nullable="false" />
<Property Name="OnlineOrderFlag" Type="Boolean" Nullable="false" />
<Property Name="SalesOrderNumber" Type="String" Nullable="false" />
<Property Name="PurchaseOrderNumber" Type="String" />
<Property Name="AccountNumber" Type="String" />
<Property Name="CustomerID" Type="Int32" Nullable="false" />
<Property Name="SalesPersonID" Type="Int32" />
<Property Name="TerritoryID" Type="Int32" />
<Property Name="ShipMethodID" Type="Int32" Nullable="false" />
<Property Name="CreditCardID" Type="Int32" />
<Property Name="CreditCardApprovalCode" Type="String" />
<Property Name="CurrencyRateID" Type="Int32" />
<Property Name="SubTotal" Type="Decimal" Nullable="false" />
<Property Name="TaxAmt" Type="Decimal" Nullable="false" />
<Property Name="Freight" Type="Decimal" Nullable="false" />
<Property Name="TotalDue" Type="Decimal" Nullable="false" />
<Property Name="Comment" Type="String" />
<Property Name="rowguid" Type="Guid" Nullable="false" />
<Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
<NavigationProperty Name="Address"
Relationship="AdvWrksSalesModel.FK_SalesOrderHeader_Address_BillToAddressID" FromRole="SalesOrderHeader" ToRole="Address" />
<NavigationProperty Name="Address1" Relationship="AdvWrksSalesModel.FK_SalesOrderHeader_Address_ShipToAddressID"
FromRole="SalesOrderHeader" ToRole="Address" />
<NavigationProperty Name="Contact" Relationship="AdvWrksSalesModel.FK_SalesOrderHeader_Contact_ContactID" FromRole="SalesOrderHeader" ToRole="Contact" />
<NavigationProperty Name="SalesOrderDetail"
Relationship="AdvWrksSalesModel.FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID"
FromRole="SalesOrderHeader" ToRole="SalesOrderDetail" />
</EntityType>
<Association Name="FK_SalesOrderHeader_Address_BillToAddressID">
<End Role="Address" Type="AdvWrksSalesModel.Address" Multiplicity="1" />
<End Role="SalesOrderHeader" Type="AdvWrksSalesModel.SalesOrderHeader" Multiplicity="*" />
</Association>
<Association Name="FK_SalesOrderHeader_Address_ShipToAddressID">
<End Role="Address" Type="AdvWrksSalesModel.Address" Multiplicity="1" />
<End Role="SalesOrderHeader" Type="AdvWrksSalesModel.SalesOrderHeader" Multiplicity="*" />
</Association>
<Association Name="FK_SalesOrderHeader_Contact_ContactID">
<End Role="Contact" Type="AdvWrksSalesModel.Contact" Multiplicity="1" />
<End Role="SalesOrderHeader" Type="AdvWrksSalesModel.SalesOrderHeader" Multiplicity="*" />
</Association>
<Association Name="FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID">
<End Role="SalesOrderHeader" Type="AdvWrksSalesModel.SalesOrderHeader" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="SalesOrderDetail" Type="AdvWrksSalesModel.SalesOrderDetail" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="SalesOrderHeader">
<PropertyRef Name="SalesOrderID" />
</Principal>
<Dependent Role="SalesOrderDetail">
<PropertyRef Name="SalesOrderID" />
</Dependent>
</ReferentialConstraint>
</Association>
</Schema>
참고 항목
개념
AdventureWorks Sales 저장소 스키마(EDM)
AdventureWorks Sales 매핑 스키마(EDM)
AdventureWorks Sales 연결(EDM)