Entity Framework table for each type - select only base type columns

First we use EF 4.3 Code and have an object model:

class Content {  }

class Product:Content { }

class News:Content { }

They are displayed as a table for each type.

There are scenarios where I just want to load only the columns belonging to the base table, for example, a list of all the content headers. But the request is like

from c in Content
where c.IsDeleted == false
select c

leads to some really nasty SQL with joining two other tables. Is there a way to make EF just make a selection from the base table only without joining other tables?

+5
source share
1 answer

TPT , EF . , , , . Linq-to-entity . Content, Product. :

  • - . Content, Product News.
  • Content - , , , , Content ( Product News). , Product News, . Linq-to-entity - ESQL OFTYPE ONLY.

, :

  • .NET 4.5 - TPT
  • Content - Product News , , Content Linq-to-entities
+3

All Articles