Entity Framework Include or Select based on Column Value

I'd like to do something like a conditional include or select based on the value of a column in my parent table.

Parent table:

Guid Id  
nvarchar(50) Name  
int Type  
Guid ObjectId

Child 1

Guid Id  
nvarchar(50) Name

Child 2

Guid Id  
nvarchar(50) Name

When I populate my model, I need to do a condition based on what type id is in the parent table.

For example

  • If the row Type == 1, then the include / select needs to be done on Child 1 for Id and Name.
  • If the type == 2 then from Child 2.

You would of course not be able to do a normal include, so would a select be the better option here? How would I go about it?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum