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
I am saving Address ValueObject on the same Users table with .OwnsOne().
Issue:
A query on Users table using .FromSql() causes unnecessary LEFT JOIN.
Using .FromSql() on a different entity (e.g. Transactions) which doesn't have a ValueObject in it works OK and doesn't include LEFT JOIN in the query.
Query example:
varcustomQuery="SELECT * FROM Users WHERE CONTAINS(*, '\"John\"')";varusers= context.Users.FromSql(customQuery);
Expected query:
SELECT*FROM Users WHERE CONTAINS(*, '\"John\"');
Actual query:
SELECT [p].[Id],
[p].[FirstName],
[p].[LastName],
[p.Address].[Id],
[p.Address].[Street],
[p.Address].[City]
FROM (SELECT*FROM Users WHERE CONTAINS(*, '\"John\"')) AS [p]
LEFT JOIN [Users] AS [p.Address]
ON [p].[Id] = [p.Address].[Id]
A bug or am I doing something incorrectly?
Further technical details
EF Core version: 2.2
Database provider: e.g. Microsoft.EntityFrameworkCore.SqlServer 2.2.6
Target framework: NET Core 2.2
Operating system: Windows 10 Enterprise
IDE: Visual Studio 2017
The text was updated successfully, but these errors were encountered:
AndriySvyryd
changed the title
Using FromSql() on DbSet<Entity> with ValueObject on same table should be without LEFT JOIN
FromSql() and owned type with table splitting
Oct 28, 2019
Entity, ValueObject and OnModelCreating() looks like this:
I am saving Address ValueObject on the same Users table with .OwnsOne().
Issue:
A query on Users table using .FromSql() causes unnecessary LEFT JOIN.
Using .FromSql() on a different entity (e.g. Transactions) which doesn't have a ValueObject in it works OK and doesn't include LEFT JOIN in the query.
Query example:
Expected query:
Actual query:
A bug or am I doing something incorrectly?
Further technical details
EF Core version: 2.2
Database provider: e.g. Microsoft.EntityFrameworkCore.SqlServer 2.2.6
Target framework: NET Core 2.2
Operating system: Windows 10 Enterprise
IDE: Visual Studio 2017
The text was updated successfully, but these errors were encountered: