How to: Query Objects with Table-per-Type Inheritance

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

This topic shows how to execute a polymorphic query by using the OfType operator.

To run the code in this example

  1. Add the School Model to your project and configure your project to use the Entity Framework. For more information, see How to: Use the Entity Data Model Wizard.

  2. Modify the conceptual model to have table-per-type inheritance by following the steps in Walkthrough: Mapping Inheritance - Table-per-Type.

Example

The following example uses the OfType method to get and display a collection of OnsiteCourses and a collection of OnlineCourses from a collection of Courses. OnsiteCourses and OnlineCourses are specific types of Courses.

See Also

Show: