- What is your product version? 10.2.0
- What is your product type (Angular or MVC)? Angular
- What is product framework type (.net framework or .net core)? .net Core
I'm trying to add a single column (RoleId) to UserOrganizationUnit
I've created a class
public class OrganizationUnitRole_Extended : UserOrganizationUnit { public virtual Role Role { get; set; } public int RoleId { get; set; } }
I've added it to the dbcontext
public virtual DbSet<OrganizationUnitRole_Extended> OrganizationUnitRole_Extended { get; set; }
However my migrations add in a discriminator
column.
Is there any way to avoid this? I've read that fluent api could resolve it but I haven't figured out how to do it properly.
3 Answer(s)
-
0
Adding [NotMapped] Public string Discriminator {get; set;} gives the correct migration... but is that ok?
-
0
Hi @jtallon
This is added by EF Core, see https://learn.microsoft.com/en-us/ef/core/modeling/inheritance#table-per-hierarchy-and-discriminator-configuration. I suggest you to not remove it because it will cause problems. You can choose a different name for this column or choose a different extension approach.
-
0