C
C#2y ago
ægteemil

❔ The foreign key property 'UserRole.RoleId1' was created in shadow state

I've expanded the default IdentityUserRole implementation for .NET identity like this:
public class UserRole : IdentityUserRole<Guid>
{
public Guid TenantId { get; set; }
public virtual Tenant Tenant { get; set; } = null!;

public virtual User User { get; set; } = null!;
public virtual Role Role { get; set; } = null!;
}
public class UserRole : IdentityUserRole<Guid>
{
public Guid TenantId { get; set; }
public virtual Tenant Tenant { get; set; } = null!;

public virtual User User { get; set; } = null!;
public virtual Role Role { get; set; } = null!;
}
And I've included the User and Role as navigation properties, which is now causing EF to write this when creating a migration: The foreign key property 'UserRole.RoleId1' was created in shadow state because a conflicting property with the simple name 'RoleId' exists in the entity type, but is either not mapped, is already used for another relationship, or is incompatible with the associated primary key type I'm not sure how to configure this properly and avoid the new foreign key property
1 Reply
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server