I have two tables that have identical properties, for example:
DbSet<Person> Students;
DbSet<Person> Teachers;
However Entity Framework does not allow the same class to be used for different tables.
So, instead I use:
DbSet<Student> Students;
DbSet<Teacher> Teachers;
public class Student : Person { }
public class Teacher : Person { }
However if I retrieve from a third party, a large set of data as
List<Person> data;
I am unable to do
Students.Add(data) <== compile time error unable to convert
nor
foreach (var item in data)
Students.Add((Student)item); <== runtime error unable to cast
Any suggestions on a good way to handle this?
Note: this is a simplistic example it is actually used for large quantities of stock price bars and performance is a big issue and I don't necessarily want to be instantiating many, many copies of an object if I can help it.