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 was unable to generate a compiled model (#1906) with the rc1 version of EF Core. I installed the rc1 version of .NET 6 and dotnet ef tool. I tried the same thing with SqlServer and SqlLite, both produce the same result. I was able to do this with the previous versions without a problem, and by definition of the keyless entity type, I believe it shouldn't be a problem.
To reproduce the bug:
Create a new project (dotnet new web --name EFCoreCompiledModelKeyless)
Install the rc1 version of Microsft.EntityFrameworkCore.SqlServer and Microsft.EntityFrameworkCore.Design in the project
Add Model.cs file with the content below
Replace Program.cs content with the content below
Run dotnet ef dbcontext optimize --context MyDbContext --output-dir Compiled --verbose
@ErikEJ but MyKeyfullEntity doesn't have a navigation that targets MyKeylessEntity. The navigation is defined on the keyless entity, which shouldn't be a problem. By definition, these are keyless entity constraints:
They may never act as the principal end of a relationship.
They may not have navigations to owned entities
They can only contain reference navigation properties pointing to regular entities.
Entities cannot contain navigation properties to keyless entity types.
MyKeylessEntity is the dependant end of the relationship, doesn't have a navigation to an owned entity, contains a reference navigation property only to regular entity (MyKeyfullEntity) and no other entity contains a navigation property to it.
To me it seems like there might be a bug in part of the code that checks for navigation properties pointing to keyless entities - if the navigation property's name is empty, it clearly isn't defined.
I was unable to generate a compiled model (#1906) with the
rc1
version of EF Core. I installed therc1
version of .NET 6 and dotnet ef tool. I tried the same thing withSqlServer
andSqlLite
, both produce the same result. I was able to do this with the previous versions without a problem, and by definition of the keyless entity type, I believe it shouldn't be a problem.To reproduce the bug:
dotnet new web --name EFCoreCompiledModelKeyless
)rc1
version ofMicrosft.EntityFrameworkCore.SqlServer
andMicrosft.EntityFrameworkCore.Design
in the projectModel.cs
file with the content belowProgram.cs
content with the content belowdotnet ef dbcontext optimize --context MyDbContext --output-dir Compiled --verbose
Model.cs
Program.cs
The result is the following:
EF Core version: 6.0 RC1
Database provider: Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.SqlLite
Target framework: .NET 6.0 RC1
Operating system: Windows 10
IDE: VS Code
The text was updated successfully, but these errors were encountered: