I’ve been seeing the question Databases for different customers, not if it would be the right thing to do.
It depends. If you want to separate databases by company, it is, but it doesn’t seem to be your case.
I’m guessing you’re using ASP.NET Core Identity. So you need to be familiar with the concept of Claims, that is, portions of identity that your user has.
To add a club to your user, you can use:
await userManager.AddClaimAsync(user, new System.Security.Claims.Claim("empresa", "A"));
Or:
usuario.Claims.Add(new IdentityUserClaim<string>
{
ClaimType = "empresa",
ClaimValue = "A"
});
contextoIdentity.Entry(usuario).State = EntityState.Modified;
await contextoIdentity.SaveChangesAsync();
Or this answer here. Whatever.
If it is very necessary that you exchange the database, you will also need to change the Connection string at runtime, probably inside a Action Filter, or in the event OnActionExecuting
of Controller.
Otherwise, just use the Entityframework.Dynamicfilters package. See here how to use.
Exactly the problem that the bank will be in the own account that will be replicated the information to the site when asked the information in the browser, and as are several clients each have an external ip and the path of the bank is system standard.
– Mailon Silva
I understood, but still do not see need for multiple banks, you can have in the customer a system multi companies that only has a registered company, I imagine that would facilitate the maintenance and also this load in your main system.
– mminetto