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 believe this scenario is not supported. It would be more clear if a user friendly error message got shown during the migration creation instead of this vague compile error.
Migrations\MyContextModelSnapshot.cs(52,29): error CS1929: 'ReferenceOwnershipBuilder' does not contain a definition for 'HasDiscriminator' and the best extension method overload 'RelationalEntityTypeBuilderExtensions.HasDiscriminator<string>(EntityTypeBuilder, string)' requires a receiver of type 'EntityTypeBuilder' [C:\Users\mulle\source\repos\ConsoleApp10\ConsoleApp10\ConsoleApp10.csproj]
Migrations\20181113112638_initial.Designer.cs(54,29): error CS1929: 'ReferenceOwnershipBuilder' does not contain a definition for 'HasDiscriminator' and the best extension method overload 'RelationalEntityTypeBuilderExtensions.HasDiscriminator<string>(EntityTypeBuilder, string)' requires a receiver of type 'EntityTypeBuilder' [C:\Users\mulle\source\repos\ConsoleApp10\ConsoleApp10\ConsoleApp10.csproj]
This is the part of the generated code that causes the compile error:
modelBuilder.Entity("ConsoleApp10.LessThanFriend", b =>{b.OwnsOne("ConsoleApp10.CityAddress","Address", b1 =>{b1.HasDiscriminator<string>("Discriminator").HasValue("CityAddress");});});
Basically b1 is of type ReferenceOwnershipBuilder. This type doesn't contain the method HasDiscriminator<>().
I believe this scenario is not supported. It would be more clear if a user friendly error message got shown during the migration creation instead of this vague compile error.
Repro:
dotnet ef migrations add Initial
dotnet build
.The following compile error is thrown:
This is the part of the generated code that causes the compile error:
Basically
b1
is of typeReferenceOwnershipBuilder
. This type doesn't contain the methodHasDiscriminator<>()
.Further technical details
EF Core packages:
Operating system: Windows 10 1809
IDE: VS 15.8.9
The text was updated successfully, but these errors were encountered: