-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Inheritance: Generated database model contains duplicate base properties #13998
Labels
breaking-change
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
type-enhancement
Milestone
Comments
Note for triage: If @MaStr11 A slightly better workaround is to bulk-update the model at the end of foreach (var entityType in modelBuilder.Model.GetEntityTypes()
.Where(e => typeof(EditorOptionsText).IsAssignableFrom(e.ClrType)))
{
entityType
.FindProperty(nameof(EditorOptionsText.Mask))
.Relational()
.ColumnName = nameof(EditorOptionsText.Mask);
} |
Note from triage: EditorOptionsText is not mapped. |
AndriySvyryd
added a commit
that referenced
this issue
Mar 26, 2019
AndriySvyryd
added a commit
that referenced
this issue
Mar 26, 2019
AndriySvyryd
added a commit
that referenced
this issue
Mar 27, 2019
AndriySvyryd
added a commit
that referenced
this issue
Mar 27, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking-change
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
type-enhancement
Steps to reproduce
I have a class hierarchy with three inheritance levels:
The model is configured like this
Expected:
There is only one Mask property created in the table:
Mask = table.Column<string>(nullable: true),
Actual:
Three properties are created:
A complete sample project can be found here.
Remark
I was able to configure the model to do the right mapping like so:
modelBuilder.Entity<EditorOptionsTextBox>().Property(eotb => eotb.Mask).HasColumnName(nameof(EditorOptionsText.Mask));
But this doesn't scale because it needs to be repeated for each concrete type.
Further technical details
EF Core version: 2.1.4
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Win 10 x64
IDE: Visual Studio 2017 15.9.1
The text was updated successfully, but these errors were encountered: