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?