Condividi tramite


Schema di mapping del modello Sales di AdventureWorks (EDM)

La specifica di mapping Entity Data Model (EDM) esegue il mapping delle entità e delle associazioni del modello concettuale alle entità e alle associazioni nei metadati di archiviazione.

Schema MSL

Lo schema di mapping è scritto nel linguaggio MSL (Mapping Specification Language). Per ulteriori informazioni sulla sintassi MSL, vedere Specifica di schemi e mapping (Entity Framework).

<?xml version="1.0" encoding="utf-8"?>
<Mapping Space="C-S" xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS">
  <EntityContainerMapping StorageEntityContainer="Person" CdmEntityContainer="AdvWksSalesEntities">
    <EntitySetMapping Name="Address">
      <EntityTypeMapping TypeName="IsTypeOf(AdvWrksSalesModel.Address)">
        <MappingFragment StoreEntitySet="Address">
          <ScalarProperty Name="AddressID" ColumnName="AddressID" />
          <ScalarProperty Name="AddressLine1" ColumnName="AddressLine1" />
          <ScalarProperty Name="AddressLine2" ColumnName="AddressLine2" />
          <ScalarProperty Name="City" ColumnName="City" />
          <ScalarProperty Name="StateProvinceID" ColumnName="StateProvinceID" />
          <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
          <ScalarProperty Name="rowguid" ColumnName="rowguid" />
          <ScalarProperty Name="ModifiedDate" ColumnName="ModifiedDate" />
        </MappingFragment>
      </EntityTypeMapping>
    </EntitySetMapping>
    <EntitySetMapping Name="Contact">
      <EntityTypeMapping TypeName="IsTypeOf(AdvWrksSalesModel.Contact)">
        <MappingFragment StoreEntitySet="Contact">
          <ScalarProperty Name="ContactID" ColumnName="ContactID" />
          <ScalarProperty Name="NameStyle" ColumnName="NameStyle" />
          <ScalarProperty Name="Title" ColumnName="Title" />
          <ScalarProperty Name="FirstName" ColumnName="FirstName" />
          <ScalarProperty Name="MiddleName" ColumnName="MiddleName" />
          <ScalarProperty Name="LastName" ColumnName="LastName" />
          <ScalarProperty Name="Suffix" ColumnName="Suffix" />
          <ScalarProperty Name="EmailAddress" ColumnName="EmailAddress" />
          <ScalarProperty Name="EmailPromotion" ColumnName="EmailPromotion" />
          <ScalarProperty Name="Phone" ColumnName="Phone" />
          <ScalarProperty Name="PasswordHash" ColumnName="PasswordHash" />
          <ScalarProperty Name="PasswordSalt" ColumnName="PasswordSalt" />
          <ScalarProperty Name="AdditionalContactInfo" ColumnName="AdditionalContactInfo" />
          <ScalarProperty Name="rowguid" ColumnName="rowguid" />
          <ScalarProperty Name="ModifiedDate" ColumnName="ModifiedDate" />
        </MappingFragment>
      </EntityTypeMapping>
    </EntitySetMapping>
    <EntitySetMapping Name="Product">
      <EntityTypeMapping TypeName="IsTypeOf(AdvWrksSalesModel.Product)">
        <MappingFragment StoreEntitySet="Product">
          <ScalarProperty Name="ProductID" ColumnName="ProductID" />
          <ScalarProperty Name="Name" ColumnName="Name" />
          <ScalarProperty Name="ProductNumber" ColumnName="ProductNumber" />
          <ScalarProperty Name="MakeFlag" ColumnName="MakeFlag" />
          <ScalarProperty Name="FinishedGoodsFlag" ColumnName="FinishedGoodsFlag" />
          <ScalarProperty Name="Color" ColumnName="Color" />
          <ScalarProperty Name="SafetyStockLevel" ColumnName="SafetyStockLevel" />
          <ScalarProperty Name="ReorderPoint" ColumnName="ReorderPoint" />
          <ScalarProperty Name="StandardCost" ColumnName="StandardCost" />
          <ScalarProperty Name="ListPrice" ColumnName="ListPrice" />
          <ScalarProperty Name="Size" ColumnName="Size" />
          <ScalarProperty Name="SizeUnitMeasureCode" ColumnName="SizeUnitMeasureCode" />
          <ScalarProperty Name="WeightUnitMeasureCode" ColumnName="WeightUnitMeasureCode" />
          <ScalarProperty Name="Weight" ColumnName="Weight" />
          <ScalarProperty Name="DaysToManufacture" ColumnName="DaysToManufacture" />
          <ScalarProperty Name="ProductLine" ColumnName="ProductLine" />
          <ScalarProperty Name="Class" ColumnName="Class" />
          <ScalarProperty Name="Style" ColumnName="Style" />
          <ScalarProperty Name="ProductSubcategoryID" ColumnName="ProductSubcategoryID" />
          <ScalarProperty Name="ProductModelID" ColumnName="ProductModelID" />
          <ScalarProperty Name="SellStartDate" ColumnName="SellStartDate" />
          <ScalarProperty Name="SellEndDate" ColumnName="SellEndDate" />
          <ScalarProperty Name="DiscontinuedDate" ColumnName="DiscontinuedDate" />
          <ScalarProperty Name="rowguid" ColumnName="rowguid" />
          <ScalarProperty Name="ModifiedDate" ColumnName="ModifiedDate" />
        </MappingFragment>
      </EntityTypeMapping>
    </EntitySetMapping>
    <EntitySetMapping Name="SalesOrderDetail">
      <EntityTypeMapping TypeName="IsTypeOf(AdvWrksSalesModel.SalesOrderDetail)">
        <MappingFragment StoreEntitySet="SalesOrderDetail">
          <ScalarProperty Name="SalesOrderID" ColumnName="SalesOrderID" />
          <ScalarProperty Name="SalesOrderDetailID" ColumnName="SalesOrderDetailID" />
          <ScalarProperty Name="CarrierTrackingNumber" ColumnName="CarrierTrackingNumber" />
          <ScalarProperty Name="OrderQty" ColumnName="OrderQty" />
          <ScalarProperty Name="ProductID" ColumnName="ProductID" />
          <ScalarProperty Name="SpecialOfferID" ColumnName="SpecialOfferID" />
          <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
          <ScalarProperty Name="UnitPriceDiscount" ColumnName="UnitPriceDiscount" />
          <ScalarProperty Name="LineTotal" ColumnName="LineTotal" />
          <ScalarProperty Name="rowguid" ColumnName="rowguid" />
          <ScalarProperty Name="ModifiedDate" ColumnName="ModifiedDate" />
        </MappingFragment>
      </EntityTypeMapping>
    </EntitySetMapping>
    <EntitySetMapping Name="SalesOrderHeader">
      <EntityTypeMapping TypeName="IsTypeOf(AdvWrksSalesModel.SalesOrderHeader)">
        <MappingFragment StoreEntitySet="SalesOrderHeader">
          <ScalarProperty Name="SalesOrderID" ColumnName="SalesOrderID" />
          <ScalarProperty Name="RevisionNumber" ColumnName="RevisionNumber" />
          <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
          <ScalarProperty Name="DueDate" ColumnName="DueDate" />
          <ScalarProperty Name="ShipDate" ColumnName="ShipDate" />
          <ScalarProperty Name="Status" ColumnName="Status" />
          <ScalarProperty Name="OnlineOrderFlag" ColumnName="OnlineOrderFlag" />
          <ScalarProperty Name="SalesOrderNumber" ColumnName="SalesOrderNumber" />
          <ScalarProperty Name="PurchaseOrderNumber" ColumnName="PurchaseOrderNumber" />
          <ScalarProperty Name="AccountNumber" ColumnName="AccountNumber" />
          <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
          <ScalarProperty Name="SalesPersonID" ColumnName="SalesPersonID" />
          <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
          <ScalarProperty Name="ShipMethodID" ColumnName="ShipMethodID" />
          <ScalarProperty Name="CreditCardID" ColumnName="CreditCardID" />
          <ScalarProperty Name="CreditCardApprovalCode" ColumnName="CreditCardApprovalCode" />
          <ScalarProperty Name="CurrencyRateID" ColumnName="CurrencyRateID" />
          <ScalarProperty Name="SubTotal" ColumnName="SubTotal" />
          <ScalarProperty Name="TaxAmt" ColumnName="TaxAmt" />
          <ScalarProperty Name="Freight" ColumnName="Freight" />
          <ScalarProperty Name="TotalDue" ColumnName="TotalDue" />
          <ScalarProperty Name="Comment" ColumnName="Comment" />
          <ScalarProperty Name="rowguid" ColumnName="rowguid" />
          <ScalarProperty Name="ModifiedDate" ColumnName="ModifiedDate" />
        </MappingFragment>
      </EntityTypeMapping>
    </EntitySetMapping>
    <AssociationSetMapping Name="FK_SalesOrderHeader_Address_BillToAddressID" TypeName="AdvWrksSalesModel.FK_SalesOrderHeader_Address_BillToAddressID" StoreEntitySet="SalesOrderHeader">
      <EndProperty Name="Address">
        <ScalarProperty Name="AddressID" ColumnName="BillToAddressID" />
      </EndProperty>
      <EndProperty Name="SalesOrderHeader">
        <ScalarProperty Name="SalesOrderID" ColumnName="SalesOrderID" />
      </EndProperty>
    </AssociationSetMapping>
    <AssociationSetMapping Name="FK_SalesOrderHeader_Address_ShipToAddressID" TypeName="AdvWrksSalesModel.FK_SalesOrderHeader_Address_ShipToAddressID" StoreEntitySet="SalesOrderHeader">
      <EndProperty Name="Address">
        <ScalarProperty Name="AddressID" ColumnName="ShipToAddressID" />
      </EndProperty>
      <EndProperty Name="SalesOrderHeader">
        <ScalarProperty Name="SalesOrderID" ColumnName="SalesOrderID" />
      </EndProperty>
    </AssociationSetMapping>
    <AssociationSetMapping Name="FK_SalesOrderHeader_Contact_ContactID" TypeName="AdvWrksSalesModel.FK_SalesOrderHeader_Contact_ContactID" StoreEntitySet="SalesOrderHeader">
      <EndProperty Name="Contact">
        <ScalarProperty Name="ContactID" ColumnName="ContactID" />
      </EndProperty>
      <EndProperty Name="SalesOrderHeader">
        <ScalarProperty Name="SalesOrderID" ColumnName="SalesOrderID" />
      </EndProperty>
    </AssociationSetMapping>
    <AssociationSetMapping Name="FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID" TypeName="AdvWrksSalesModel.FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID" StoreEntitySet="SalesOrderDetail">
      <EndProperty Name="SalesOrderHeader">
        <ScalarProperty Name="SalesOrderID" ColumnName="SalesOrderID" />
      </EndProperty>
      <EndProperty Name="SalesOrderDetail">
        <ScalarProperty Name="SalesOrderID" ColumnName="SalesOrderID" />
        <ScalarProperty Name="SalesOrderDetailID" ColumnName="SalesOrderDetailID" />
      </EndProperty>
    </AssociationSetMapping>
  </EntityContainerMapping>
</Mapping>

Vedere anche

Concetti

Schema concettuale del modello Sales di AdventureWorks (EDM)
Schema di archiviazione del modello Sales di AdventureWorks (EDM)
Connessione al modello Sales di AdventureWorks (EDM)