Use of newer functions, although explicitly older version 3.1 chosen, navigation properties
FSharpCSharp opened this issue · 4 comments
I have created a model here, which refers to the 3.X version of the Entity Framework.
However, the generated code contains functions available only in higher versions, despite the choice of the 3.X version.
'EntityTypeBuilder<Xyz>' does not contain a definition for 'Navigation' and no accessible extension method 'Navigation' accepting a first argument of type 'EntityTypeBuilder<Xyz>' could be found (are you missing a using directive or an assembly reference?)
Here in the Entity Framework Core source code you can see that quite well. The "Navigation" function exists only in the newer versions, in version 3.X it was not present at this point.
Current version:
https://github.com/dotnet/efcore/blob/f54b9dcd189c91fc4b01b79c9387d23095819a8f/src/EFCore/Metadata/Builders/EntityTypeBuilder.cs#L230
Old version 3.1:
https://github.com/dotnet/efcore/blob/release/3.1/src/EFCore/Metadata/Builders/EntityTypeBuilder.cs
For this reason a compilation is not possible. The following packages are present in the .NET Framework 4.8 project:
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="3.1.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="3.1.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.11">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="3.1.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational.Design" Version="1.1.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.11">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Did I maybe forget something, or overlooked something? Unfortunately, so far I can't get the model for the old version 3.1 to work at all. This is really a pity.
Progress update on this. It's been tracked down to the designer incorrectly tying the chosen EF version to capabilities (therefore, to code generation type). The fix is underway and is currently in the testing stage.
Could you give 3.0.4 RC1 (available at https://github.com/msawczyn/EFDesigner/blob/master/dist/Sawczyn.EFDesigner.EFModel.DslPackage.vsix) a try? I believe this problem is now resolved.
That sounds excellent! Unfortunately, I won't be able to test it today, but I will definitely do so next week. I would then give a short feedback if everything is working properly now! Have a nice weekend, and thanks for the quick analysis / possible fix of the problem!
Good news! Looks like the bug is indeed fixed. Thanks a lot for that.