Add the ADO.NET Entity Data Model item template

  1. Select the CourseManager project in Solution Explorer, right-click, point to Add, and then click New Item.

  2. Select ADO.NET Entity Data Model in the Templates pane.

  3. Type School.edmx for the model name and click Add. The opening page of the Entity Data Model Wizard is displayed.

    Figure 2.103. School.edmx

    School.edmx

Generate the EDM

  1. Select

    Generate from database

    in the

    Choose Model Contents dialog box

    . Then click

    Next

    .

    Figure 2.104. Model Contents

    Model Contents

  2. Click the

    New Connection

    button.

    Figure 2.105. New Connection

    New Connection

  3. Choose the OpenLink

    Virtuoso Data Source

    and click

    Continue

    .

    Figure 2.106. Virtuoso Data Source

    Virtuoso Data Source

  4. In the

    Connection Properties

    dialog specify the

    hostname, portno, username and password

    for the target Virtuoso Server and click the

    Advanced

    button.

    Figure 2.107. Connection Properties

    Connection Properties

  5. In the

    Advanced Properties

    dialog set the

    Database parameter

    to

    School

    and click OK.

    Figure 2.108. Advanced Properties

    Advanced Properties

  6. Press the

    Test Connection

    dialog to verify the database is accessible.

    Figure 2.109. Test Connection

    Test Connection

  7. Set the

    entity connect string name

    to

    SchoolEntities

    and click

    Next

    .

    Figure 2.110. entity connect string name

    entity connect string name

  8. In the

    Choose your Database Objects

    page select the

    Tables

    check box to select all table in the

    School database

    for addition to the EDM, set the

    Model Namespace

    to

    SchoolModel

    and click

    Finish

    .

    Figure 2.111. Database Objects

    Database Objects

View the EDM in the ADO.NET Entity Data Model Designer

  1. In the

    Solution Explorer

    , double-click the

    School.edmx

    file. This displays the School model in the ADO.NET Entity Data Model Designer window.

    Figure 2.112. Solution Explorer

    Solution Explorer

  2. From the

    View

    menu, select

    Other Windows

    , and then click

    Model Browser

    to display the

    Entity Model Browser

    window.

  3. Expand the

    SchoolModel

    and

    SchoolModel.Store

    nodes to view conceptual and store definitions, respectively.

    Figure 2.113. SchoolModel

    SchoolModel

  4. From the

    View menu

    , select

    Other Windows

    , click

    Mapping Details

    , and then click an entity (Person for example) or association in the Entity Designer.

  5. This displays the Entity Mapping Details window with information about the object-relational mapping for the selected object.

    Figure 2.114. View menu

    View menu