I have a scenario very similar to this question but I am trying to to something a bit more complex.
To recap, I basically have a List of Cases, each one of a different type:
Case -> CaseA
Case -> CaseB
Case -> CaseC
Every derived Case
class has one or more navigational properties which I need to include:
Case -> CaseA -> Employee
Case -> CaseB -> List<Something>
Case -> CaseC -> List<SomethingElse>
Now, of course I could do a massive switch
statement but I am looking for something clever like this:
foreach(var myCase in ListOfCases)
{
context.LoadAll(myCase); // <- THIS!
context.Entry(myCase).LoadAllProperties() // <- OR THIS...
// etc. etc.
}
Of course the methods do not exist so I was wondering if anyone has ever had a similar problem and what could be a nice and clever way to solve it.
Thanks!