Partager via


School Model (EDM)

The School model is an Entity Data Model (EDM) based on the School database. To create the School database, follow the instructions in the topic Creating the School Sample Database (Entity Framework Quickstart). You can also use Entity Data Model tools to define the School model. For more information, see Quickstart (Entity Framework).

Note

The School model supports type inheritance and other more complex models when you make only minor modifications. For more information on how to use the Entity Data Model Designer to update the School model to support such complex models, see ADO.NET Entity Data Model Designer Scenarios.

Connection

The following settings in the app.config file define the connection to the School model:

<configuration>
    <connectionStrings>
        <add name="SchoolEntities"
             connectionString="metadata=.\School.csdl|.\School.ssdl|.\School.msl;
             provider=System.Data.SqlClient;provider connection string='Data Source=localhost;
             Initial Catalog=School;Integrated Security=True;MultipleActiveResultSets=True'"
             providerName="System.Data.EntityClient" />
    </connectionStrings>
</configuration>

Data Model Definition

The EDM for the School model is defined in the following conceptual schema definition language (CSDL), store schema definition language (SSDL), and mapping specification language (MSL) files.

Conceptual Schema

<Schema Namespace="SchoolModel" Alias="Self" xmlns="https://schemas.microsoft.com/ado/2006/04/edm">
    <EntityContainer Name="SchoolEntities">
        <EntitySet Name="Course" EntityType="SchoolModel.Course" />
        <EntitySet Name="CourseGrade" EntityType="SchoolModel.CourseGrade" />
        <EntitySet Name="Department" EntityType="SchoolModel.Department" />
        <EntitySet Name="OfficeAssignment" EntityType="SchoolModel.OfficeAssignment" />
        <EntitySet Name="OnlineCourse" EntityType="SchoolModel.OnlineCourse" />
        <EntitySet Name="OnsiteCourse" EntityType="SchoolModel.OnsiteCourse" />
        <EntitySet Name="Person" EntityType="SchoolModel.Person" />
        <AssociationSet Name="FK_Course_Department" Association="SchoolModel.FK_Course_Department">
            <End Role="Department" EntitySet="Department" />
            <End Role="Course" EntitySet="Course" />
        </AssociationSet>
        <AssociationSet Name="FK_CourseGrade_Course" Association="SchoolModel.FK_CourseGrade_Course">
            <End Role="Course" EntitySet="Course" />
            <End Role="CourseGrade" EntitySet="CourseGrade" />
        </AssociationSet>
        <AssociationSet Name="FK_OnlineCourse_Course" Association="SchoolModel.FK_OnlineCourse_Course">
            <End Role="Course" EntitySet="Course" />
            <End Role="OnlineCourse" EntitySet="OnlineCourse" />
        </AssociationSet>
        <AssociationSet Name="FK_OnsiteCourse_Course" Association="SchoolModel.FK_OnsiteCourse_Course">
            <End Role="Course" EntitySet="Course" />
            <End Role="OnsiteCourse" EntitySet="OnsiteCourse" />
        </AssociationSet>
        <AssociationSet Name="FK_CourseGrade_Student" Association="SchoolModel.FK_CourseGrade_Student">
            <End Role="Person" EntitySet="Person" />
            <End Role="CourseGrade" EntitySet="CourseGrade" />
        </AssociationSet>
        <AssociationSet Name="FK_OfficeAssignment_Person" 
                Association="SchoolModel.FK_OfficeAssignment_Person">
            <End Role="Person" EntitySet="Person" />
            <End Role="OfficeAssignment" EntitySet="OfficeAssignment" />
        </AssociationSet>
        <AssociationSet Name="CourseInstructor" Association="SchoolModel.CourseInstructor">
            <End Role="Course" EntitySet="Course" />
            <End Role="Person" EntitySet="Person" />
        </AssociationSet>
    </EntityContainer>
    <EntityType Name="Course">
        <Key>
            <PropertyRef Name="CourseID" />
        </Key>
        <Property Name="CourseID" Type="Int32" Nullable="false" />
        <Property Name="Title" Type="String" Nullable="false" MaxLength="100" 
          Unicode="true" FixedLength="false" />
        <Property Name="Credits" Type="Int32" Nullable="false" />
        <NavigationProperty Name="Department" Relationship="SchoolModel.FK_Course_Department" 
                            FromRole="Course" ToRole="Department" />
        <NavigationProperty Name="CourseGrade" Relationship="SchoolModel.FK_CourseGrade_Course" 
                            FromRole="Course" ToRole="CourseGrade" />
        <NavigationProperty Name="OnlineCourse" Relationship="SchoolModel.FK_OnlineCourse_Course" 
                            FromRole="Course" ToRole="OnlineCourse" />
        <NavigationProperty Name="OnsiteCourse" Relationship="SchoolModel.FK_OnsiteCourse_Course" 
                            FromRole="Course" ToRole="OnsiteCourse" />
        <NavigationProperty Name="Person" Relationship="SchoolModel.CourseInstructor" FromRole="Course" 
                            ToRole="Person" />
    </EntityType>
    <EntityType Name="CourseGrade">
        <Key>
            <PropertyRef Name="EnrollmentID" />
        </Key>
        <Property Name="EnrollmentID" Type="Int32" Nullable="false" />
        <Property Name="Grade" Type="Decimal" Precision="3" Scale="2" />
        <NavigationProperty Name="Course" Relationship="SchoolModel.FK_CourseGrade_Course" 
                            FromRole="CourseGrade" ToRole="Course" />
        <NavigationProperty Name="Person" Relationship="SchoolModel.FK_CourseGrade_Student" 
                            FromRole="CourseGrade" ToRole="Person" />
    </EntityType>
    <EntityType Name="Department">
        <Key>
            <PropertyRef Name="DepartmentID" />
        </Key>
        <Property Name="DepartmentID" Type="Int32" Nullable="false" />
        <Property Name="Name" Type="String" Nullable="false" MaxLength="50" Unicode="true" 
          FixedLength="false" />
        <Property Name="Budget" Type="Decimal" Nullable="false" Precision="19" Scale="4" />
        <Property Name="StartDate" Type="DateTime" Nullable="false" />
        <Property Name="Administrator" Type="Int32" />
        <NavigationProperty Name="Course" Relationship="SchoolModel.FK_Course_Department" 
                    FromRole="Department" ToRole="Course" />
    </EntityType>
    <EntityType Name="OfficeAssignment">
        <Key>
            <PropertyRef Name="InstructorID" />
        </Key>
        <Property Name="InstructorID" Type="Int32" Nullable="false" />
        <Property Name="Location" Type="String" Nullable="false" MaxLength="50" 
          Unicode="true" FixedLength="false" />
        <NavigationProperty Name="Person" Relationship="SchoolModel.FK_OfficeAssignment_Person" 
                    FromRole="OfficeAssignment" ToRole="Person" />
    </EntityType>
    <EntityType Name="OnlineCourse">
        <Key>
            <PropertyRef Name="CourseID" />
        </Key>
        <Property Name="CourseID" Type="Int32" Nullable="false" />
        <Property Name="URL" Type="String" Nullable="false" MaxLength="100" Unicode="true" 
          FixedLength="false" />
        <NavigationProperty Name="Course" Relationship="SchoolModel.FK_OnlineCourse_Course" 
                    FromRole="OnlineCourse" ToRole="Course" />
    </EntityType>
    <EntityType Name="OnsiteCourse">
        <Key>
            <PropertyRef Name="CourseID" />
        </Key>
        <Property Name="CourseID" Type="Int32" Nullable="false" />
        <Property Name="Location" Type="String" Nullable="false" MaxLength="50" Unicode="true" 
          FixedLength="false" />
        <Property Name="Days" Type="String" Nullable="false" MaxLength="50" Unicode="true" 
          FixedLength="false" />
        <Property Name="Time" Type="DateTime" Nullable="false" />
        <NavigationProperty Name="Course" Relationship="SchoolModel.FK_OnsiteCourse_Course" 
                    FromRole="OnsiteCourse" ToRole="Course" />
    </EntityType>
    <EntityType Name="Person">
        <Key>
            <PropertyRef Name="PersonID" />
        </Key>
        <Property Name="PersonID" Type="Int32" Nullable="false" />
        <Property Name="LastName" Type="String" Nullable="false" MaxLength="50" Unicode="true" 
          FixedLength="false" />
        <Property Name="FirstName" Type="String" Nullable="false" MaxLength="50" Unicode="true" 
          FixedLength="false" />
        <Property Name="HireDate" Type="DateTime" />
        <Property Name="EnrollmentDate" Type="DateTime" />
        <NavigationProperty Name="CourseGrade" Relationship="SchoolModel.FK_CourseGrade_Student" 
                    FromRole="Person" ToRole="CourseGrade" />
        <NavigationProperty Name="OfficeAssignment" Relationship="SchoolModel.FK_OfficeAssignment_Person" 
                    FromRole="Person" ToRole="OfficeAssignment" />
        <NavigationProperty Name="Course" Relationship="SchoolModel.CourseInstructor" FromRole="Person" 
                    ToRole="Course" />
    </EntityType>
    <Association Name="FK_Course_Department">
        <End Role="Department" Type="SchoolModel.Department" Multiplicity="1" />
        <End Role="Course" Type="SchoolModel.Course" Multiplicity="*" />
    </Association>
    <Association Name="FK_CourseGrade_Course">
        <End Role="Course" Type="SchoolModel.Course" Multiplicity="1" />
        <End Role="CourseGrade" Type="SchoolModel.CourseGrade" Multiplicity="*" />
    </Association>
    <Association Name="FK_OnlineCourse_Course">
        <End Role="Course" Type="SchoolModel.Course" Multiplicity="1" />
        <End Role="OnlineCourse" Type="SchoolModel.OnlineCourse" Multiplicity="0..1" />
        <ReferentialConstraint>
            <Principal Role="Course">
                <PropertyRef Name="CourseID" />
            </Principal>
            <Dependent Role="OnlineCourse">
                <PropertyRef Name="CourseID" />
            </Dependent>
        </ReferentialConstraint>
    </Association>
    <Association Name="FK_OnsiteCourse_Course">
        <End Role="Course" Type="SchoolModel.Course" Multiplicity="1" />
        <End Role="OnsiteCourse" Type="SchoolModel.OnsiteCourse" Multiplicity="0..1" />
        <ReferentialConstraint>
            <Principal Role="Course">
                <PropertyRef Name="CourseID" />
            </Principal>
            <Dependent Role="OnsiteCourse">
                <PropertyRef Name="CourseID" />
            </Dependent>
        </ReferentialConstraint>
    </Association>
    <Association Name="FK_CourseGrade_Student">
        <End Role="Person" Type="SchoolModel.Person" Multiplicity="1" />
        <End Role="CourseGrade" Type="SchoolModel.CourseGrade" Multiplicity="*" />
    </Association>
    <Association Name="FK_OfficeAssignment_Person">
        <End Role="Person" Type="SchoolModel.Person" Multiplicity="1" />
        <End Role="OfficeAssignment" Type="SchoolModel.OfficeAssignment" Multiplicity="0..1" />
        <ReferentialConstraint>
            <Principal Role="Person">
                <PropertyRef Name="PersonID" />
            </Principal>
            <Dependent Role="OfficeAssignment">
                <PropertyRef Name="InstructorID" />
            </Dependent>
        </ReferentialConstraint>
    </Association>
    <Association Name="CourseInstructor">
        <End Role="Course" Type="SchoolModel.Course" Multiplicity="*" />
        <End Role="Person" Type="SchoolModel.Person" Multiplicity="*" />
    </Association>
</Schema>

Store Schema

<Schema Namespace="SchoolModel.Store" Alias="Self" Provider="System.Data.SqlClient" 
        ProviderManifestToken="2005" 
        xmlns:store="https://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" 
        xmlns="https://schemas.microsoft.com/ado/2006/04/edm/ssdl">
    <EntityContainer Name="dbo">
        <EntitySet Name="Course" EntityType="SchoolModel.Store.Course" store:Type="Tables" />
        <EntitySet Name="CourseGrade" EntityType="SchoolModel.Store.CourseGrade" store:Type="Tables" />
        <EntitySet Name="CourseInstructor" EntityType="SchoolModel.Store.CourseInstructor" store:Type="Tables" />
        <EntitySet Name="Department" EntityType="SchoolModel.Store.Department" store:Type="Tables" />
        <EntitySet Name="OfficeAssignment" EntityType="SchoolModel.Store.OfficeAssignment" store:Type="Tables" />
        <EntitySet Name="OnlineCourse" EntityType="SchoolModel.Store.OnlineCourse" store:Type="Tables" />
        <EntitySet Name="OnsiteCourse" EntityType="SchoolModel.Store.OnsiteCourse" store:Type="Tables" />
        <EntitySet Name="Person" EntityType="SchoolModel.Store.Person" store:Type="Tables" />
        <AssociationSet Name="FK_Course_Department" Association="SchoolModel.Store.FK_Course_Department">
            <End Role="Department" EntitySet="Department" />
            <End Role="Course" EntitySet="Course" />
        </AssociationSet>
        <AssociationSet Name="FK_CourseGrade_Course" Association="SchoolModel.Store.FK_CourseGrade_Course">
            <End Role="Course" EntitySet="Course" />
            <End Role="CourseGrade" EntitySet="CourseGrade" />
        </AssociationSet>
        <AssociationSet Name="FK_CourseGrade_Student" Association="SchoolModel.Store.FK_CourseGrade_Student">
            <End Role="Person" EntitySet="Person" />
            <End Role="CourseGrade" EntitySet="CourseGrade" />
        </AssociationSet>
        <AssociationSet Name="FK_CourseInstructor_Course" Association="SchoolModel.Store.FK_CourseInstructor_Course">
            <End Role="Course" EntitySet="Course" />
            <End Role="CourseInstructor" EntitySet="CourseInstructor" />
        </AssociationSet>
        <AssociationSet Name="FK_CourseInstructor_Person" Association="SchoolModel.Store.FK_CourseInstructor_Person">
            <End Role="Person" EntitySet="Person" />
            <End Role="CourseInstructor" EntitySet="CourseInstructor" />
        </AssociationSet>
        <AssociationSet Name="FK_OfficeAssignment_Person" Association="SchoolModel.Store.FK_OfficeAssignment_Person">
            <End Role="Person" EntitySet="Person" />
            <End Role="OfficeAssignment" EntitySet="OfficeAssignment" />
        </AssociationSet>
        <AssociationSet Name="FK_OnlineCourse_Course" Association="SchoolModel.Store.FK_OnlineCourse_Course">
            <End Role="Course" EntitySet="Course" />
            <End Role="OnlineCourse" EntitySet="OnlineCourse" />
        </AssociationSet>
        <AssociationSet Name="FK_OnsiteCourse_Course" Association="SchoolModel.Store.FK_OnsiteCourse_Course">
            <End Role="Course" EntitySet="Course" />
            <End Role="OnsiteCourse" EntitySet="OnsiteCourse" />
        </AssociationSet>
    </EntityContainer>
    <EntityType Name="Course">
        <Key>
            <PropertyRef Name="CourseID" />
        </Key>
        <Property Name="CourseID" Type="int" Nullable="false" />
        <Property Name="Title" Type="nvarchar" Nullable="false" MaxLength="100" />
        <Property Name="Credits" Type="int" Nullable="false" />
        <Property Name="DepartmentID" Type="int" Nullable="false" />
    </EntityType>
    <EntityType Name="CourseGrade">
        <Key>
            <PropertyRef Name="EnrollmentID" />
        </Key>
        <Property Name="EnrollmentID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
        <Property Name="CourseID" Type="int" Nullable="false" />
        <Property Name="StudentID" Type="int" Nullable="false" />
        <Property Name="Grade" Type="decimal" Precision="3" Scale="2" />
    </EntityType>
    <EntityType Name="CourseInstructor">
        <Key>
            <PropertyRef Name="CourseID" />
            <PropertyRef Name="PersonID" />
        </Key>
        <Property Name="CourseID" Type="int" Nullable="false" />
        <Property Name="PersonID" Type="int" Nullable="false" />
    </EntityType>
    <EntityType Name="Department">
        <Key>
            <PropertyRef Name="DepartmentID" />
        </Key>
        <Property Name="DepartmentID" Type="int" Nullable="false" />
        <Property Name="Name" Type="nvarchar" Nullable="false" MaxLength="50" />
        <Property Name="Budget" Type="money" Nullable="false" />
        <Property Name="StartDate" Type="datetime" Nullable="false" />
        <Property Name="Administrator" Type="int" />
    </EntityType>
    <EntityType Name="OfficeAssignment">
        <Key>
            <PropertyRef Name="InstructorID" />
        </Key>
        <Property Name="InstructorID" Type="int" Nullable="false" />
        <Property Name="Location" Type="nvarchar" Nullable="false" MaxLength="50" />
    </EntityType>
    <EntityType Name="OnlineCourse">
        <Key>
            <PropertyRef Name="CourseID" />
        </Key>
        <Property Name="CourseID" Type="int" Nullable="false" />
        <Property Name="URL" Type="nvarchar" Nullable="false" MaxLength="100" />
    </EntityType>
    <EntityType Name="OnsiteCourse">
        <Key>
            <PropertyRef Name="CourseID" />
        </Key>
        <Property Name="CourseID" Type="int" Nullable="false" />
        <Property Name="Location" Type="nvarchar" Nullable="false" MaxLength="50" />
        <Property Name="Days" Type="nvarchar" Nullable="false" MaxLength="50" />
        <Property Name="Time" Type="smalldatetime" Nullable="false" />
    </EntityType>
    <EntityType Name="Person">
        <Key>
            <PropertyRef Name="PersonID" />
        </Key>
        <Property Name="PersonID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
        <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="50" />
        <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="50" />
        <Property Name="HireDate" Type="datetime" />
        <Property Name="EnrollmentDate" Type="datetime" />
    </EntityType>
    <Association Name="FK_Course_Department">
        <End Role="Department" Type="SchoolModel.Store.Department" Multiplicity="1" />
        <End Role="Course" Type="SchoolModel.Store.Course" Multiplicity="*" />
        <ReferentialConstraint>
            <Principal Role="Department">
                <PropertyRef Name="DepartmentID" />
            </Principal>
            <Dependent Role="Course">
                <PropertyRef Name="DepartmentID" />
            </Dependent>
        </ReferentialConstraint>
    </Association>
    <Association Name="FK_CourseGrade_Course">
        <End Role="Course" Type="SchoolModel.Store.Course" Multiplicity="1" />
        <End Role="CourseGrade" Type="SchoolModel.Store.CourseGrade" Multiplicity="*" />
        <ReferentialConstraint>
            <Principal Role="Course">
                <PropertyRef Name="CourseID" />
            </Principal>
            <Dependent Role="CourseGrade">
                <PropertyRef Name="CourseID" />
            </Dependent>
        </ReferentialConstraint>
    </Association>
    <Association Name="FK_CourseGrade_Student">
        <End Role="Person" Type="SchoolModel.Store.Person" Multiplicity="1" />
        <End Role="CourseGrade" Type="SchoolModel.Store.CourseGrade" Multiplicity="*" />
        <ReferentialConstraint>
            <Principal Role="Person">
                <PropertyRef Name="PersonID" />
            </Principal>
            <Dependent Role="CourseGrade">
                <PropertyRef Name="StudentID" />
            </Dependent>
        </ReferentialConstraint>
    </Association>
    <Association Name="FK_CourseInstructor_Course">
        <End Role="Course" Type="SchoolModel.Store.Course" Multiplicity="1" />
        <End Role="CourseInstructor" Type="SchoolModel.Store.CourseInstructor" Multiplicity="*" />
        <ReferentialConstraint>
            <Principal Role="Course">
                <PropertyRef Name="CourseID" />
            </Principal>
            <Dependent Role="CourseInstructor">
                <PropertyRef Name="CourseID" />
            </Dependent>
        </ReferentialConstraint>
    </Association>
    <Association Name="FK_CourseInstructor_Person">
        <End Role="Person" Type="SchoolModel.Store.Person" Multiplicity="1" />
        <End Role="CourseInstructor" Type="SchoolModel.Store.CourseInstructor" Multiplicity="*" />
        <ReferentialConstraint>
            <Principal Role="Person">
                <PropertyRef Name="PersonID" />
            </Principal>
            <Dependent Role="CourseInstructor">
                <PropertyRef Name="PersonID" />
            </Dependent>
        </ReferentialConstraint>
    </Association>
    <Association Name="FK_OfficeAssignment_Person">
        <End Role="Person" Type="SchoolModel.Store.Person" Multiplicity="1" />
        <End Role="OfficeAssignment" Type="SchoolModel.Store.OfficeAssignment" Multiplicity="0..1" />
        <ReferentialConstraint>
            <Principal Role="Person">
                <PropertyRef Name="PersonID" />
            </Principal>
            <Dependent Role="OfficeAssignment">
                <PropertyRef Name="InstructorID" />
            </Dependent>
        </ReferentialConstraint>
    </Association>
    <Association Name="FK_OnlineCourse_Course">
        <End Role="Course" Type="SchoolModel.Store.Course" Multiplicity="1" />
        <End Role="OnlineCourse" Type="SchoolModel.Store.OnlineCourse" Multiplicity="0..1" />
        <ReferentialConstraint>
            <Principal Role="Course">
                <PropertyRef Name="CourseID" />
            </Principal>
            <Dependent Role="OnlineCourse">
                <PropertyRef Name="CourseID" />
            </Dependent>
        </ReferentialConstraint>
    </Association>
    <Association Name="FK_OnsiteCourse_Course">
        <End Role="Course" Type="SchoolModel.Store.Course" Multiplicity="1" />
        <End Role="OnsiteCourse" Type="SchoolModel.Store.OnsiteCourse" Multiplicity="0..1" />
        <ReferentialConstraint>
            <Principal Role="Course">
                <PropertyRef Name="CourseID" />
            </Principal>
            <Dependent Role="OnsiteCourse">
                <PropertyRef Name="CourseID" />
            </Dependent>
        </ReferentialConstraint>
    </Association>
</Schema>

Mapping

<Mapping Space="C-S" xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS">
    <EntityContainerMapping StorageEntityContainer="dbo" CdmEntityContainer="SchoolEntities">
        <EntitySetMapping Name="Course">
            <EntityTypeMapping TypeName="IsTypeOf(SchoolModel.Course)">
                <MappingFragment StoreEntitySet="Course">
                    <ScalarProperty Name="CourseID" ColumnName="CourseID" />
                    <ScalarProperty Name="Title" ColumnName="Title" />
                    <ScalarProperty Name="Credits" ColumnName="Credits" />
                </MappingFragment>
            </EntityTypeMapping>
        </EntitySetMapping>
        <EntitySetMapping Name="CourseGrade">
            <EntityTypeMapping TypeName="IsTypeOf(SchoolModel.CourseGrade)">
                <MappingFragment StoreEntitySet="CourseGrade">
                    <ScalarProperty Name="EnrollmentID" ColumnName="EnrollmentID" />
                    <ScalarProperty Name="Grade" ColumnName="Grade" />
                </MappingFragment>
            </EntityTypeMapping>
        </EntitySetMapping>
        <EntitySetMapping Name="Department">
            <EntityTypeMapping TypeName="IsTypeOf(SchoolModel.Department)">
                <MappingFragment StoreEntitySet="Department">
                    <ScalarProperty Name="DepartmentID" ColumnName="DepartmentID" />
                    <ScalarProperty Name="Name" ColumnName="Name" />
                    <ScalarProperty Name="Budget" ColumnName="Budget" />
                    <ScalarProperty Name="StartDate" ColumnName="StartDate" />
                    <ScalarProperty Name="Administrator" ColumnName="Administrator" />
                </MappingFragment>
            </EntityTypeMapping>
        </EntitySetMapping>
        <EntitySetMapping Name="OfficeAssignment">
            <EntityTypeMapping TypeName="IsTypeOf(SchoolModel.OfficeAssignment)">
                <MappingFragment StoreEntitySet="OfficeAssignment">
                    <ScalarProperty Name="InstructorID" ColumnName="InstructorID" />
                    <ScalarProperty Name="Location" ColumnName="Location" />
                </MappingFragment>
            </EntityTypeMapping>
        </EntitySetMapping>
        <EntitySetMapping Name="OnlineCourse">
            <EntityTypeMapping TypeName="IsTypeOf(SchoolModel.OnlineCourse)">
                <MappingFragment StoreEntitySet="OnlineCourse">
                    <ScalarProperty Name="CourseID" ColumnName="CourseID" />
                    <ScalarProperty Name="URL" ColumnName="URL" />
                </MappingFragment>
            </EntityTypeMapping>
        </EntitySetMapping>
        <EntitySetMapping Name="OnsiteCourse">
            <EntityTypeMapping TypeName="IsTypeOf(SchoolModel.OnsiteCourse)">
                <MappingFragment StoreEntitySet="OnsiteCourse">
                    <ScalarProperty Name="CourseID" ColumnName="CourseID" />
                    <ScalarProperty Name="Location" ColumnName="Location" />
                    <ScalarProperty Name="Days" ColumnName="Days" />
                    <ScalarProperty Name="Time" ColumnName="Time" />
                </MappingFragment>
            </EntityTypeMapping>
        </EntitySetMapping>
        <EntitySetMapping Name="Person">
            <EntityTypeMapping TypeName="IsTypeOf(SchoolModel.Person)">
                <MappingFragment StoreEntitySet="Person">
                    <ScalarProperty Name="PersonID" ColumnName="PersonID" />
                    <ScalarProperty Name="LastName" ColumnName="LastName" />
                    <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                    <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                    <ScalarProperty Name="EnrollmentDate" ColumnName="EnrollmentDate" />
                </MappingFragment>
            </EntityTypeMapping>
        </EntitySetMapping>
        <AssociationSetMapping Name="FK_Course_Department" TypeName="SchoolModel.FK_Course_Department" 
                               StoreEntitySet="Course">
            <EndProperty Name="Department">
                <ScalarProperty Name="DepartmentID" ColumnName="DepartmentID" />
            </EndProperty>
            <EndProperty Name="Course">
                <ScalarProperty Name="CourseID" ColumnName="CourseID" />
            </EndProperty>
        </AssociationSetMapping>
        <AssociationSetMapping Name="FK_CourseGrade_Course" TypeName="SchoolModel.FK_CourseGrade_Course" 
                               StoreEntitySet="CourseGrade">
            <EndProperty Name="Course">
                <ScalarProperty Name="CourseID" ColumnName="CourseID" />
            </EndProperty>
            <EndProperty Name="CourseGrade">
                <ScalarProperty Name="EnrollmentID" ColumnName="EnrollmentID" />
            </EndProperty>
        </AssociationSetMapping>
        <AssociationSetMapping Name="FK_OnlineCourse_Course" TypeName="SchoolModel.FK_OnlineCourse_Course" 
                               StoreEntitySet="OnlineCourse">
            <EndProperty Name="Course">
                <ScalarProperty Name="CourseID" ColumnName="CourseID" />
            </EndProperty>
            <EndProperty Name="OnlineCourse">
                <ScalarProperty Name="CourseID" ColumnName="CourseID" />
            </EndProperty>
        </AssociationSetMapping>
        <AssociationSetMapping Name="FK_OnsiteCourse_Course" TypeName="SchoolModel.FK_OnsiteCourse_Course" 
                               StoreEntitySet="OnsiteCourse">
            <EndProperty Name="Course">
                <ScalarProperty Name="CourseID" ColumnName="CourseID" />
            </EndProperty>
            <EndProperty Name="OnsiteCourse">
                <ScalarProperty Name="CourseID" ColumnName="CourseID" />
            </EndProperty>
        </AssociationSetMapping>
        <AssociationSetMapping Name="FK_CourseGrade_Student" TypeName="SchoolModel.FK_CourseGrade_Student" 
                               StoreEntitySet="CourseGrade">
            <EndProperty Name="Person">
                <ScalarProperty Name="PersonID" ColumnName="StudentID" />
            </EndProperty>
            <EndProperty Name="CourseGrade">
                <ScalarProperty Name="EnrollmentID" ColumnName="EnrollmentID" />
            </EndProperty>
        </AssociationSetMapping>
        <AssociationSetMapping Name="FK_OfficeAssignment_Person" TypeName="SchoolModel.FK_OfficeAssignment_Person" 
                               StoreEntitySet="OfficeAssignment">
            <EndProperty Name="Person">
                <ScalarProperty Name="PersonID" ColumnName="InstructorID" />
            </EndProperty>
            <EndProperty Name="OfficeAssignment">
                <ScalarProperty Name="InstructorID" ColumnName="InstructorID" />
            </EndProperty>
        </AssociationSetMapping>
        <AssociationSetMapping Name="CourseInstructor" TypeName="SchoolModel.CourseInstructor" 
                               StoreEntitySet="CourseInstructor">
            <EndProperty Name="Course">
                <ScalarProperty Name="CourseID" ColumnName="CourseID" />
            </EndProperty>
            <EndProperty Name="Person">
                <ScalarProperty Name="PersonID" ColumnName="PersonID" />
            </EndProperty>
        </AssociationSetMapping>
    </EntityContainerMapping>
</Mapping>

See Also

Other Resources

Getting Started (Entity Framework)