-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with inherited owned type #20220
Comments
@lenraven Just to clarify, based on your OnModelCreating code, you want |
Note for team: This still repros even when both types are mapped as owned entities and nothing is ignored in the model. |
@ajcvickers Yes, the mapping, what I created, do it. But I checked it again, and the problem will be occurred, only when the DateRange, and the BookingInterval are on same Entity and not depends on it is ignored or not. The following model will NOT occur the problem:
|
@lenraven Thanks for the additional info. @bricelam @AndriySvyryd Tried this on recent daily build and it now throws when adding the migration:
|
@lenraven Try adding this line as a workaround: entityBuilder.OwnsOne(p => p.Interval, ob =>
{
ob.GetInfrastructure().HasNoDeclaredDiscriminator(ConfigurationSource.Explicit);
}); |
@AndriySvyryd Unfortunately this solution did not solve the problem. |
Possibly a symptom of #19311 |
I have a problem with mapping of a complex domain model.
The problem is the generated mapping of Owned type.
When I created a migration step, then there will be two compiler error in the code.
Model what I want to map
The Context file with mapping
The problem
When I call the Add-Migration command, then the following Snapshot will be generated.
So the problem is that, the
b1.HasDiscriminator();
method case compiler error.And same problem is in Designer file of migration step.
Workaround
I found a workaround to this problem, but it is not fitting well with my domain model.
The model of workaround:
Further technical details
EF Core version: 3.1.2
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: All traget
Operating system: Windows 10
IDE: Visual Studio 2019 16.4.5
The text was updated successfully, but these errors were encountered: