You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My case is I am trying to get all Products with Users from all Orders. Basically, I have two ways how to do it, but first way ignores Include and second doesn't.
SELECT [x.Items.Product].[Id], [x.Items.Product].[UserId]
FROM [Orders] AS [x]
INNER JOIN [OrderItems] AS [x.Items] ON [x].[Id] = [x.Items].[OrderId]
INNER JOIN [Products] AS [x.Items.Product] ON [x.Items].[ProductId] = [x.Items.Product].[Id]
SELECT [x.Items.Product].[Id], [x.Items.Product].[UserId], [x.Items.Product.User].[Id], [x.Items.Product.User].[Name]
FROM [Orders] AS [x]
INNER JOIN [OrderItems] AS [x.Items] ON [x].[Id] = [x.Items].[OrderId]
INNER JOIN [Products] AS [x.Items.Product] ON [x.Items].[ProductId] = [x.Items.Product].[Id]
INNER JOIN [Users] AS [x.Items.Product.User] ON [x.Items.Product].[UserId] = [x.Items.Product.User].[Id]
Further technical details
EF Core version: 2.2.1
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2017 15.9.6
The text was updated successfully, but these errors were encountered:
It seems, EF Core ignores
Include(...)
method after callingSelectMany(...)
Steps to reproduce
Let's say I have 4 basic models:
And
DbContext
My case is I am trying to get all
Products
withUsers
from allOrders
. Basically, I have two ways how to do it, but first way ignoresInclude
and second doesn't.Include
Output SQL:
Include
Output SQL:
Further technical details
EF Core version: 2.2.1
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2017 15.9.6
The text was updated successfully, but these errors were encountered: