-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tenancy support #13
Comments
Bucket is a partition that allow you to share the same StreamId on different contexts, non strictly a Tenant: you could use a bucket for a Tenant, for a Bounded Context, for Aggregate, etc So bucket is only a logical partition, not a physical one => no additional tables per bucket. |
It's a possible way, but the effort is huge to change the existing logic. We actually use IConnectionFactory with connectionstrings. We don't want to maintain all the connection strings and therefore switch to dynamic connections. You started already to develop in this way, but it seems without a clear concept. To have all the tenants in one database is not an option. |
NEventStore doesn't have the concept of Tenant, only the concept of EventStore mapping to one database from the very beginning (we work with NES from v3). |
What is the IConnectionFactory for? |
to factory a IDbConnection to the db for commands and queries. |
Sorry, but I don't see the point actually. What are the scenarios where you would factory the IDbConnection for the db for command and query? Just trying to understand the whole concept, before I go and change the my application architecture 1 EventStore per Db. |
The IDbConnection is implemented by a custom ConnectionScope (per thread). |
So you are caching in this case the connection on the thread. The supported concept is to always to connect to the same database and not to switch to different databases? |
yes, always on the same db. If you need to connect to another db you should factory a new evenstore instance. |
Thanks and sorry for the statement "no clear concept" 😏 |
👍 |
I seems that I do not understand the concept of the IConnectionFactory.
You have the SqlPersistenceEngine and there is a method Initialize which creates the database tables during the bootup of the application. How do you know for which tenant. IConnectionFactory is not able to figure this out without the bucketId. This can't be done during startup of the application. The IConnectionFactory.Open should get the bucketId passed like mentioned here #2
IConnectionFactory could also have a method IsInitialized(buckedId) which must be implemented by different providers so that you know if the tables should be created or not. Another option is that you cache the IDbConnnection.ConnectionString to figure out if the initialization is required.
The text was updated successfully, but these errors were encountered: