-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linq Navigation join with nullable FK loads ALL(redundant) columns from second table. #8191
Labels
Comments
borisdj
changed the title
Linq join with nullable FK loads ALL(reundant) columns from second table.
Linq Navigation join with nullable FK loads ALL(reundant) columns from second table.
Apr 17, 2017
@maumar to find the dupe. |
dupe of #6647 |
borisdj
changed the title
Linq Navigation join with nullable FK loads ALL(reundant) columns from second table.
Linq Navigation join with nullable FK loads ALL(redundant) columns from second table.
Apr 17, 2017
So it is already fixed, great. |
@borisdj on our current bits the following SQL is generated for this scenario: SELECT [a].[UserId], [a].[Email], [a].[FullName], [a].[PartyId], [a.Party].[Name]
FROM [Users] AS [a]
LEFT JOIN [Parties] AS [a.Party] ON [a].[PartyId] = [a.Party].[PartyId]
WHERE [a].[Deleted] = 0
ORDER BY [a].[UserId]
OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY |
That SQL looks much better. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Only one column from second table is specified for join, but when query is analysed from SqlProfiler it selects all columns.
Steps to reproduce
Main Table
Join Table
Linq:
Profiler:
Columns Desc and SomeInfo should NOT be in query.
This showcase was simplified just to emphasis the issues.
In real scenario Party table has much more columns and some tables have more then one nullable FK, so I don't want all those column loaded from DB when I do not need them.
I am actually using AutoMapper instead of manually mapping these Properties but generated query is same in both cases. Showcase is with manual mapping just to point that it's not because of AM.
Further technical details
EF Core version: 1.1.1
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2017
The text was updated successfully, but these errors were encountered: