Lets suppose that I have a db table with name Employee and a respective EF 6.0 db-first model.
Getting all rows of table Employee is done through q
Why not use some good old fashioned polymorphism?
partial class Employee : IEmployee { }
partial class HistoricalEmployee : IEmployee { }
interface IEmployee {
public string Name { get; set; }
}
void PrintEmployeeName(IEmployee employee)
{
Debug.WriteLine(employee.Name);
}
PrintEmployeeName(context.Employees.First());
PrintEmployeeName(context.HistoricalEmployees.First());