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.
2 Replies
an user than spans through tenants? is that legal?
what's a profile? and why are roles tied to user and not profile?
Yeah its legal, similar to how you can have a Zoho account and have access to different organizations help desks. Profiles are basicicly what I was calling roles in my system that had permissions assigned to them. The default Identity tables for .NET have roles assigned to their User table. Thats why I was wondering if there was a better way to structure this or change the default relations.