I Supplier class:
public class Supplier {
....
....
....
}
I have also Subcontractor class and Subcontractor is a Supplier:
public class Subcontractor:Supplier {
....
....
....
}
In my db I have Suppliers table with data and another table with id field which is act as foreign key to suppliers table and I have in there also the subcintractor data.
In the entity framework edmx file I declared the inheritance relation:

Now I want to gett all the suppliers which are not subcontractors so I am doing:
context.Suppliers.OfType<Supplier>();
But this returns also the subcontractors..
How can I get only the Suppliers that are not subcontractors?
Give this a try:
Edit
If you have more than one class which derives from
Supplierthe only option with LINQ to Entities seems to be something like:Entity SQL supports an ONLY keyword which allows to query for a specific type. But a corresponding counterpart is not available as LINQ operator.
Here is an implementation of an
OfTypeOnly<TEntity>operator but it makes heavy use of metadata information and manual expression building and might be overkill in simple scenarios.