Entity Framework : Filter query by property of a child type
问题 I have model as below class Person { public int Id { get; set; } public string Name { get; set; } } class Employee : Person { public string Dep { get; set; } } class Client : Person { public string Type { get; set; } } Now I would like to query Person by a property of Employee as follows context.Set<Person>().Where(x => ((Employee)x).Dep == "dep").ToList(); But I get the following error Unable to cast the type 'DomainModel.Person' to type 'DomainModel.Employee'. LINQ to Entities only supports