Hi, I've another ASP.NET application (using ASP.NET Identity) where I needs to sync the users between ASPZERO project and trhe other ASP.NET application (using ASP.NET Identity). What would be a way to do this ? Any hints for me? Thanks!
8 Answer(s)
-
0
There is a correspondence between identity and zero tables. You can compare some differences between them, such as TenantId. Then synchronize them.
| Abp Tables | Identity Tables | | --- | --- | |AbpUsers|AspNetUsers| |AbpUserClaims|AspNetUserLogins| |AbpUserTokens|AspNetUserTokens| |AbpUserLogins|AspNetUserLogins| |AbpUserRoles|AspNetUserRoles| |AbpRoles|AspNetRoles| |AbpRoleClaims|AspNetRoleClaims|
AbpUserAccounts => When someone uses DB per tenant architecture, some of tenant's user tables will be stored in a seperate database. In this case, it is hard to query all users in the whole system.
UserAccounts table is a copy of all tenant's users tables stored in host database. In this way we can query all users from a single table at once. We have used this for linking users to each other.
-
0
The abp user table uses long as the primary key type. This cannot be changed.
You may be using string as the primary key type for the user table.(https://docs.microsoft.com/en-us/aspnet/identity/overview/extensibility/change-primary-key-for-users-in-aspnet-identity)
So you can convert the string to long during synchronization.
You need to store these mapping because other tables may need it, such as AbpUserClaims etc.
| AspNetUsers | AbpUsers | | --- | --- | |e317bce5-1a6e-443c-8b9f-6e346962bb60 | 1 | |2b52c5a0-48c3-43ff-bf7a-7abcfa399fe4 | 2 |
-
0
ok thanks - I'll create own mapping table with these two fields - this should work then...
AspNetUsers AbpUsers e317bce5-1a6e-443c-8b9f-6e346962bb60 1 2b52c5a0-48c3-43ff-bf7a-7abcfa399fe4 2
-
0
Last question - in AspNetUsers there is no tenant ID - in our ASP.NET application we can assign a user to different tenants. In AbpUsers this is not possible?
-
0
Last question - in AspNetUsers there is no tenant ID - in our ASP.NET application we can assign a user to different tenants. In AbpUsers this is not possible?
-
0
Last question - in AspNetUsers there is no tenant ID - in our ASP.NET application we can assign a user to different tenants. In AbpUsers this is not possible?
-
0
AbpUsers table hava TenantId column. You can assign a value to the user's TenantId when synchronizing it according to the actual situation.