Closed JonPSmith closed 2 years ago
Agree :-) Just found this project - Does it have to use SQL server ?
Have a look at the Roadmap discussions for a roadmap of what I'm planning to do - that includes supporting PostgreSQL, but no other database types.
PS. @FELS-Zak, why were you interested with this feature?
In AuthP versions before version 3 the aim was to get all the multi-tenant data within one database. In this case AuthP used a external DbTransactions approach. This provides one transaction that covers two DbContexts at the same time, but the code is rather complex as couldn't get an instance of the tenant's database DbContext via DI, but you needed to add extra code to manually create the tenant's database DbContext
With the addition in version 3 of the AuthP library of database sharding I decided to simplify the transaction into two separate transactions, with the second transaction run started from within the first transaction. This means that both transactions have to be successful for the database to be updated.
This does mean that the ITenantChangeService
has changed a lot. Please see the Update To Version 3 file for how update your version 2 code to version 3.
this seems to be broken
Have a look at the Roadmap discussions for a roadmap of what I'm planning to do - that includes supporting PostgreSQL, but no other database types.
Is there a reason you're not considering other database types like MySQL, Oracle?
Hi @akema-trebla,
this seems to be broken
Yep, that won't be out until version 3.
Is there a reason you're not considering other database types like MySQL, Oracle?
This library is really complex and is taking a lot of work, which I do for free. The more database types a support requires extra work, but the real reason I want to support lots of databases is the yearly update to the library to the changes in EF Core for each database type.
Implemented in version 3
An application using AuthP's multi-tenant feature requires a service that implements the
ITenantChangeService
which is called when a tenant is created, updated, moved or deleted. The current implementation creates a transaction that covers both the AuthP DbContext and the application's DbContext.This works, but has the following limitations:
ITenantChangeService
is quite complex for the user - it would be nice to make it simpler. One approach would have an abstract class containing a default creation of the application's DbContext, with a way to override that default creation of the DbContext if the developer needs to add extra features.Possible solution
Looking at the code it could be changed to a transaction on just the AuthP DbContext, and within that transaction a call to the (modified)
ITenantChangeService
. If the ChangeService fails / returns an error it can roll back the AuthP changes.For some changes, like delete and move, the
ITenantChangeService
would need a transaction too. In this case it gets complex.Things to look at