简体   繁体   中英

Entity Framework Multiple Table to Single Entity isnt querying both tables

I have a Article and Blog tables that I want to represent as a Content Entity. I have mapped both tables to the Content entity however when I query using a ObjectSet.Take(20) only the article table is being hit in the dbase. Am i wrong in thinking (hoping) the query should look where contentType = 1 and 2?

Ta

SQL query looks like this...

SELECT 
[Extent1].[RhythmyxContentId] AS [RhythmyxContentId], 
[Extent1].[PublishDate] AS [PublishDate], 
[Extent1].[Title] AS [Title], 
[Extent1].[Promo] AS [Promo], 
[Extent1].[AuthorUid] AS [AuthorUid], 
[Extent1].[Body] AS [Body], 
[Extent1].[IsDeleted] AS [IsDeleted], 
[Extent1].[IsLive] AS [IsLive], 
[Extent1].[UpdateDate] AS [UpdateDate], 
[Extent1].[CreatedDate] AS [CreatedDate], 
[Extent1].[Slug] AS [Slug], 
[Extent1].[ContentCategoryId] AS [ContentCategoryId]
FROM [dbo].[tArticle] AS [Extent1]
WHERE [Extent1].[ContentType] =  CAST( '1' AS int)

Heres the entity... 替代文字

I can help, but can you show me the two entities and the current code you are using to fetch it.

I think you are complicating it slightly by setting the content type logic in the edmx, show me what you are trying to do and it will be easy to help you out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM