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
In Entity Framework core 3.1.3, I have used the value object feature. In the query side, the problem is an extra left join exists in TSql. This extra join results problems in terms of performance.
publicclassApplicationDbContext:DbContext{publicDbSet<Student> Students {get;set;}protectedoverridevoidOnModelCreating(ModelBuilderbuilder){
builder.Entity<Student>().OwnsOne(e => e.Address);base.OnModelCreating(builder);}}
Entity framework query
varlist= _dbContext.Students.ToList();
Generated SQL
SELECT [s].[Id], [s].[Name], [t].[Id], [t].[Address_City],
[t].[Address_Street], [t].[Address_ZipCode]
FROM [Students] AS [s]
LEFT JOIN (
SELECT [s0].[Id], [s0].[Address_City],
[s0].[Address_Street], [s0].[Address_ZipCode]
FROM [Students] AS [s0]
WHERE [s0].[Address_ZipCode] IS NOT NULLOR
([s0].[Address_Street] IS NOT NULLOR
[s0].[Address_City] IS NOT NULL)
) AS [t] ON [s].[Id] = [t].[Id]
Further technical details
EF Core version:
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET Core 3.1.1
Operating system: Windows 10
IDE: Visual Studio 2019 16.3
The text was updated successfully, but these errors were encountered:
In Entity Framework core 3.1.3, I have used the value object feature. In the query side, the problem is an extra left join exists in TSql. This extra join results problems in terms of performance.
Entities
DbContext
Entity framework query
Generated SQL
Further technical details
EF Core version:
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET Core 3.1.1
Operating system: Windows 10
IDE: Visual Studio 2019 16.3
The text was updated successfully, but these errors were encountered: