lucabriguglia / OpenCQRS

.NET Standard framework to create simple and clean design. Advanced features for DDD, CQRS and Event Sourcing.
Apache License 2.0
3 stars 115 forks source link

Support for tenant store #104

Open etiennecl opened 4 years ago

etiennecl commented 4 years ago

I know the purpose of this library is to support DDD, CQRS and event sourcing. I was wondering where it would make more sense to extend this library in order to add Tenant Support has the StoreProvider is already inside the Base project and the EF projects already implement the StoreProvider interface.

My first guess would be to add a TenantId to my Aggregates, entities, commands, and events, but I don't see how I could enforce this when creating a new AggregateRoot or applying a global filter in the StoreProvider in order to scope the data of the current tenant?

lucabriguglia commented 4 years ago

Interesting concept, there is the Source property that can be set in the Command but it is saved in the store only for commands and events. Yhe tenant could be set in the aggregate.