I have such class structure
public class Aclass { ... }
public class Bclass : Aclass { ... }
public class Cclass : Bclass { ... }
I try to get all data (by EF6) passing some condition and be only of type Bclass.
_dbContext.Aclasses
.Where(condition)
.Where(p => p is B)
.ToList();
But my query download also object which are Cclass objects(I understand it's ok). I can add condition for
.Where(p is Bclass && !(p is Cclass))
but if I decide in future to add next derivation class I'll need to change such code.
My question is: how can I determine in EF query to get only specified objects, without derived objects?