I was tasked as a homework assignment to make a task tracker. I wanted to learn entity framework for this assignment, especially how to use the inheritance aspects. Projects, tasks and sub-tasks all have a lot of similar properties, so I thought I would use inheritance, but can’t figure out how to query particular projects.
I drew this diagram in Visual Studio:

I then created the database from this model. How can I get an Employees Projects?
I’ve started with this:
ModelContainer m = new ModelContainer();
var employee = (from e in m.Employees
where e.UserName == username
select e).First<Employee>();
But ((Employee)employee).Projects is not available, but ((Employee)employee).Items is. ((Employee)employee).Items.Projects is also not available. How do I get an Employee’s projects? Should I add a Navigation Property to Employees for this?
You’ll have to use the Queryable.OfType(TResult) extension method in order to filter the entities of type Manager:
Related resources: