I try to filter derived classes in my entities, but I get an exception.
var filtered = db.PersonSet.OfType<Person>().
Where(person =>person.GetType()==typeof(Person))
I get below exceptions if I try to loop filter through foreach.
"LINQ to Entities does not recognize the" System.Type GetType () "method, and this method cannot be translated into a repository expression.".
How can I overcome it? What could be an alternative way to filter?
source
share