开发者

Entity Framework Multiple Table to Single Entity isnt querying both tables

I 开发者_如何学Gohave 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...

Entity Framework Multiple Table to Single Entity isnt querying both tables


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜