The EDMX itself contains the contents of core model/mapping files for Entity Framework:
- Conceptual schema definition language (.csdl) - defines the conceptual model.
- Store schema definition language file (.ssdl) - defines the storage model, aka logical model.
- Mapping specification language file (.msl) - defines the mapping between the storage and conceptual models.
Here is an article from the ADO.NET team blog on Extracting CSDL from EDMX.
Here is my generated EDMX file:
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="PersonModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">
<EntityContainer Name="PersonModelStoreContainer">
<EntitySet Name="Person" EntityType="PersonModel.Store.Person" store:Type="Tables" Schema="dbo" />
<EntitySet Name="Profile" EntityType="PersonModel.Store.Profile" store:Type="Tables" Schema="dbo" />
<AssociationSet Name="FK_Profile_Person" Association="PersonModel.Store.FK_Profile_Person">
<End Role="Person" EntitySet="Person" />
<End Role="Profile" EntitySet="Profile" />
</AssociationSet>
</EntityContainer>
<EntityType Name="Person">
<Key>
<PropertyRef Name="PersonID" />
</Key>
<Property Name="PersonID" Type="bigint" Nullable="false" />
<Property Name="LoginID" Type="varchar" Nullable="false" MaxLength="100" />
<Property Name="Password" Type="varchar" Nullable="false" MaxLength="32" />
</EntityType>
<EntityType Name="Profile">
<Key>
<PropertyRef Name="ProfileID" />
</Key>
<Property Name="ProfileID" Type="bigint" Nullable="false" />
<Property Name="PersonID" Type="bigint" Nullable="false" />
<Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="100" />
<Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="100" />
<Property Name="EmailAddress" Type="nvarchar" Nullable="false" MaxLength="255" />
</EntityType>
<Association Name="FK_Profile_Person">
<End Role="Person" Type="PersonModel.Store.Person" Multiplicity="1" />
<End Role="Profile" Type="PersonModel.Store.Profile" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Person">
<PropertyRef Name="PersonID" />
</Principal>
<Dependent Role="Profile">
<PropertyRef Name="PersonID" />
</Dependent>
</ReferentialConstraint>
</Association>
</Schema>
</edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="PersonModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm">
<EntityContainer Name="PersonEntities">
<EntitySet Name="Person" EntityType="PersonModel.Person" />
<EntitySet Name="Profile" EntityType="PersonModel.Profile" />
<AssociationSet Name="FK_Profile_Person" Association="PersonModel.FK_Profile_Person">
<End Role="Person" EntitySet="Person" />
<End Role="Profile" EntitySet="Profile" />
</AssociationSet>
</EntityContainer>
<EntityType Name="Person">
<Key>
<PropertyRef Name="PersonID" />
</Key>
<Property Name="PersonID" Type="Int64" Nullable="false" />
<Property Name="LoginID" Type="String" Nullable="false" MaxLength="100" Unicode="false" FixedLength="false" />
<Property Name="Password" Type="String" Nullable="false" MaxLength="32" Unicode="false" FixedLength="false" />
<NavigationProperty Name="Profile" Relationship="PersonModel.FK_Profile_Person" FromRole="Person" ToRole="Profile" />
</EntityType>
<EntityType Name="Profile">
<Key>
<PropertyRef Name="ProfileID" />
</Key>
<Property Name="ProfileID" Type="Int64" Nullable="false" />
<Property Name="FirstName" Type="String" Nullable="false" MaxLength="100" Unicode="true" FixedLength="false" />
<Property Name="LastName" Type="String" Nullable="false" MaxLength="100" Unicode="true" FixedLength="false" />
<Property Name="EmailAddress" Type="String" Nullable="false" MaxLength="255" Unicode="true" FixedLength="false" />
<NavigationProperty Name="Person" Relationship="PersonModel.FK_Profile_Person" FromRole="Profile" ToRole="Person" />
</EntityType>
<Association Name="FK_Profile_Person">
<End Role="Person" Type="PersonModel.Person" Multiplicity="1" />
<End Role="Profile" Type="PersonModel.Profile" Multiplicity="*" />
</Association>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS">
<EntityContainerMapping StorageEntityContainer="PersonModelStoreContainer" CdmEntityContainer="PersonEntities">
<EntitySetMapping Name="Person">
<EntityTypeMapping TypeName="IsTypeOf(PersonModel.Person)">
<MappingFragment StoreEntitySet="Person">
<ScalarProperty Name="PersonID" ColumnName="PersonID" />
<ScalarProperty Name="LoginID" ColumnName="LoginID" />
<ScalarProperty Name="Password" ColumnName="Password" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Profile">
<EntityTypeMapping TypeName="IsTypeOf(PersonModel.Profile)">
<MappingFragment StoreEntitySet="Profile">
<ScalarProperty Name="ProfileID" ColumnName="ProfileID" />
<ScalarProperty Name="FirstName" ColumnName="FirstName" />
<ScalarProperty Name="LastName" ColumnName="LastName" />
<ScalarProperty Name="EmailAddress" ColumnName="EmailAddress" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<AssociationSetMapping Name="FK_Profile_Person" TypeName="PersonModel.FK_Profile_Person" StoreEntitySet="Profile">
<EndProperty Name="Person">
<ScalarProperty Name="PersonID" ColumnName="PersonID" />
</EndProperty>
<EndProperty Name="Profile">
<ScalarProperty Name="ProfileID" ColumnName="ProfileID" />
</EndProperty>
</AssociationSetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
</edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</edmx:Connection>
<edmx:Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
</DesignerInfoPropertySet>
</edmx:Options>
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram Name="Person">
<EntityTypeShape EntityType="PersonModel.Person" Width="1.5" PointX="0.75" PointY="1" Height="1.592306315104167" IsExpanded="true" />
<EntityTypeShape EntityType="PersonModel.Profile" Width="1.5" PointX="3" PointY="0.875" Height="1.7566536458333333" IsExpanded="true" />
<AssociationConnector Association="PersonModel.FK_Profile_Person" ManuallyRouted="false">
<ConnectorPoint PointX="2.25" PointY="1.7961531575520835" />
<ConnectorPoint PointX="3" PointY="1.7961531575520835" /></AssociationConnector></Diagram></edmx:Diagrams>
</edmx:Designer>
</edmx:Edmx>
Here is how it appears in Visual Studio Design View:
No comments:
Post a Comment