2017-01-16 4 views
1

私はLINQを使って複数のテーブルからデータを照会しています。Entity Frameworkを作る方法JOINを実行するときにいくつかのフィールドを照会します

var test= await _context.Article 
.Select(a => new 
{ 
    a.ID, 
    a.Title, 
    a.CreatedTime, 
    a.EditedTime, 
    a.Author.UserName, 
    a.AuthorID 
}).ToListAsync(); 

AuthorArticleクラスのナビゲーションプロパティです。

しかし、私は、ログからこれを得た:

Executed DbCommand (6ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] 
     SELECT [a].[ID], [a].[AuthorID], [a].[Content], [a].[CreatedTime], [a].[EditedTime], [a].[Title], [a.Author].[Id], [a.Author].[AccessFailedCount], [a.Author].[ConcurrencyStamp], [a.Author].[Email], [a.Author].[EmailConfirmed], [a.Author].[LockoutEnabled], [a.Author].[LockoutEnd], [a.Author].[NormalizedEmail], [a.Author].[NormalizedUserName], [a.Author].[PasswordHash], [a.Author].[PhoneNumber], [a.Author].[PhoneNumberConfirmed], [a.Author].[SecurityStamp], [a.Author].[TwoFactorEnabled], [a.Author].[UserName] 
     FROM [Article] AS [a] 
     LEFT JOIN [AspNetUsers] AS [a.Author] ON [a].[AuthorID] = [a.Author].[Id] 
     ORDER BY [a].[AuthorID] 

私は、フィールドのいくつかをしたいが、それはそれらのすべてを照会します。私のコードからa.Author.UserName行を削除すると、期待どおりに機能します。

私は何かを見逃しましたか?

Microsoft SQL ServerでEntity Framework Core 1.1.0を使用しています。

答えて

1

は、この動作は、すでにdocumented as bugで、クールなマイルストーン2.0.0

+1

を予定して固定します。今、 "唯一の"問題は、2.0.0が来て、人々がこれらのバグすべてをどうするべきかということです。 –

関連する問題