C#C
C#2y ago
Lx0044

Changing the .Net Identity Table's Relationships

What's up everyone. I am playing around with using Identity in a multitenant environment where a user can have profiles in different tenants. My schema before involving Identity was:

In this schema a user can belong to multiple tenants, and for that tenant they can have multiple profiles.

Tenant

User

TenantUser

TenantUserProfile

Profile

In my mind what Profiles, a user has should be referenced to the join table TenantUser. The default Identity models have the UserRole table referenced to User.

Should I keep it this way and just add a tenant column to their join table UserRole, or is there a way to change the underlying relationships in oncreate? I have seen a lot of examples of changing names and adding columns, but not any about changing relationship keys etc.
Was this page helpful?