i want to get userId on asp.net core web service to change database connection string based on userId.
Project Type : Asp.net core + Angular [lates v.7.0]
4 Answer(s)
-
0
How to get User ID in ASP.NET Core?
using IAbpSession see: https://aspnetboilerplate.com/Pages/Documents/Abp-Session
change database connection string based on userId.
You may know that each tenant in zero can specify a separate database connection string. Do you want to specify a separate connection string based on the user?
-
0
Do you want to specify a separate connection string based on the user? Yes a. Kindly guide me for separate connection string based on user. b. also guide me for separate connection string based on tenant.
Or may you take my remote connection for once?
-
0
b. also guide me for separate connection string based on tenant.
When we create a new tenant, we should select/create a database to store new tenant's data. We can select 'Use host database' to store tenant data in host database (can be used for single database approach) or we can specify a connection string to create/use a dedicated database for new tenant. ASP.NET Zero supports hybrid approach. That means you can use host database for some tenants and create dedicated databases for some other tenants. Even you can group some tenants in a separated database.
The abp framework automatically switches the database connection string based on the current tenant.
a. Kindly guide me for separate connection string based on user.
DbPerTenantConnectionStringResolver(https://github.com/aspnetboilerplate/aspnetboilerplate/blob/e0ded5d8702f389aa1f5947d3446f16aec845287/src/Abp.ZeroCore.EntityFrameworkCore/Zero/EntityFrameworkCore/DbPerTenantConnectionStringResolver.cs#L13) is an implementation of a tenant using a standalone database. I don't think the application should specify a database for each user. This may also be incompatible with the current abp and zero.
-
0
This issue is closed because it has not had recent activity for a long time.