Hello, we are trying to resolve issues related to switching between host and customer DBs.
Our purpose :- Insert,Update and Get data as per the connectionString of tenant from Host layer API as well as from newly created Microservice layer API
I was trying to switch the database using connection string So I added one method ContextFactory in DbContext.cs file(EntityFrameworkCore layer)
Create a sample API in Demo.HttpApi.Host layer and Call the ContextFactory method which returns a given connectionString context object.
Using that object i am able to access all the tables but getting error 'Object reference not set to an instance of an object'
My question is:how can we change the context and get the data from Host layer API as well as Microservice API ?
ABP Framework version: v4.2.0 UI type: Angular DB provider: EF Core Tiered (MVC) or Identity Server Separated (Angular): yes Exception message and stack trace: Steps to reproduce the issue:
Hello, we are trying to resolve issue related to switching between host and customer DBs..
Our solution is deployed with host DB and separated Identity Server (IS) (running as separate microservice and using host DB). We would like to use Multi-tenant solution with separate DB for each tenant. We are trying to use centralized IS to handle all requests. We already created our custom override of CreateAsync method in TenantAppService to create some custom actions during tenant creation (tenant DB creation, running some seed methods, etc.). UpdateDefaultConnectionStringAsync is called too in our method to update SaasTenantConnectionStrings table in host DB.
So when we create new tenant from host app, there is a new tenant DB, SaasTenantConnectionStrings table in host DB contains correct connection string too. We have also a wildcard rule in IdentityServerClientRedirectUris table in IS.
When we access https://tenant1.ourappurl/ and click Login, we are redirected to the correct IS page with login. My question is: Can we identify the tenant using the domain resolver to direct to the tenant db once the authorization is completed on the centralised IS server?
Thanks a lot!