|
Generate Code for Business-Object Classes with the Conceptual Schema
Listing 2. The NorthwindLib.Model.CSDL schema defines the EDM’s business-object layer model and the VB or C# classes that the Entity Data Model Wizard generates when you build an Entity Model class library for the first time. The conceptual schema also includes AssociationSets and Associations. If you edit the SSDL and MSL files only, you don’t need to update the CSDL file and recompile the class library. <?xml version="1.0" encoding="utf-8"?>
<Schema xmlns:cg=
"http://schemas.microsoft.com/ado/2006/04/codegeneration"
xmlns:edm="http://schemas.microsoft.com/ado/2006/04/edm"
xmlns="http://schemas.microsoft.com/ado/2006/04/edm"
Namespace="NorthwindLib" Alias="Self" >
<EntityContainer Name="Northwind">
<EntitySet Name="Categories" EntityType="Self.Category" />
<EntitySet Name="Products" EntityType="Self.Product" />
<EntitySet Name="Customers" EntityType="Self.Customer" />
<EntitySet Name="SalesOrders" EntityType="Self.SalesOrder" />
<AssociationSet Name="CustomerOrders"
Association="Self.Customer_Order">
<End Role="Customer" EntitySet="Customers"/>
<End Role="SalesOrder" EntitySet="SalesOrders" />
</AssociationSet>
<AssociationSet Name="CategoryProducts"
Association="Self.Category_Product">
<End Role="Category" EntitySet="Categories"/>
<End Role="Product" EntitySet="Products" />
</AssociationSet>
</EntityContainer>
<EntityType Name="Category" Key="CategoryID">
<Property Name="CategoryID" Type="Int32" Nullable="false"
StoreGenerated="true" ClientAutoGenerated="true" />
<Property Name="CategoryName" Type="String"
Nullable="false" MaxLength="15" ConcurrencyMode="fixed"/>
<Property Name="Description" Type="String" Nullable="true"
MaxLength="255" />
<NavigationProperty Name="Products"
Relationship="Self.Category_Product" FromRole="Category"
ToRole="Product"/>
</EntityType>
<EntityType Name="Product" Key="ProductID">
<Property Name="ProductID" Type="Int32" Nullable="false"
StoreGenerated="true" ClientAutoGenerated="true" />
<Property Name="ProductName" Type="String" Nullable="false"
MaxLength="40" ConcurrencyMode="fixed"/>
<!--<Property Name="CategoryID" Type="Int32"
Nullable="false" />-->
<Property Name="UnitPrice" Type="Decimal" Nullable="true"
Precision="10" Scale="2" ConcurrencyMode="fixed"/>
<NavigationProperty Name="Category"
Relationship="Self.Category_Product" FromRole="Product"
ToRole="Category"/>
</EntityType>
<EntityType Name="DiscontinuedProduct"
BaseType="Self.Product">
<Property Name="UnitsInStock" Type="Int16" Nullable="true" />
</EntityType>
<EntityType Name="Customer" Key="CustomerID">
<Property Name="CustomerID" Type="String" Nullable="false"
MaxLength="5" FixedLength="true"/>
<Property Name="CompanyName" Type="String"
Nullable="false" MaxLength="40" ConcurrencyMode="fixed"/>
<Property Name="ContactName" Type="String" Nullable="true"
MaxLength="30" ConcurrencyMode="fixed"/>
<Property Name="City" Type="String" Nullable="true"
MaxLength="15" ConcurrencyMode="fixed"/>
<Property Name="Country" Type="String" Nullable="true"
MaxLength="15" ConcurrencyMode="fixed"/>
<NavigationProperty Name="SalesOrders"
Relationship="Self.Customer_Order" FromRole="Customer"
ToRole="SalesOrder"/>
</EntityType>
<EntityType Name="SalesOrder" Key="OrderID">
<Property Name="OrderID" Type="Int32" Nullable="false" />
<Property Name="CustomerID" Type="String" Nullable="true"
MaxLength="50" FixedLength="true" />
<Property Name="OrderDate" Type="DateTime"
Nullable="true" />
<Property Name="ShipCity" Type="String" Nullable="true"
MaxLength="15" />
<Property Name="ShipCountry" Type="String" Nullable="true"
MaxLength="15" />
<NavigationProperty Name="Customer"
Relationship="Self.Customer_Order"
FromRole="SalesOrder" ToRole="Customer"/>
</EntityType>
<Association Name="Customer_Order">
<End Role="Customer" Type="Self.Customer" Multiplicity="1" />
<End Role="SalesOrder" Type="Self.SalesOrder"
Multiplicity="0..*" PluralRole="SalesOrders" />
</Association>
<Association Name="Category_Product">
<End Role="Category" Type="Self.Category" Multiplicity="1" />
<End Role="Product" Type="Self.Product" Multiplicity="0..*"
PluralRole="Products" />
</Association>
</Schema>
|