RavenDB implementation of the Finbuckle.MultiTenant store.
Finbuckle.MultiTenant is open source multi-tenancy middleware for .NET. For more information about Finbuckle.MultiTenant visit the official website.
Using the NuGet package manager install the Mcrio.Finbuckle.Multitenant.RavenDb.Store package, or add the following line to the .csproj file:
<ItemGroup>
<PackageReference Include="Mcrio.Finbuckle.Multitenant.RavenDb.Store"></PackageReference>
</ItemGroup>
Add the following lines to Startup.cs.
// ConfigureServices(...)
services
// adds finbuckle support as per official documentation
.AddMultiTenant<TenantInfo>()
// adds RavenDb store by providing Tenant info type and RavenDb store type.
// both can be extended to suit your requirements
.WithRavenDbStore<TenantInfo, FinbuckleRavenDbStore<TenantInfo>>(
// define how IAsyncDocumentSession is resolved from DI
// as library does NOT directly inject IAsyncDocumentSession
provider => provider.GetRequiredService<IAsyncDocumentSession>().Session
)
Extend Finbuckle.MultiTenant.TenantInfo
or Finbuckle.MultiTenant.ITenantInfo
and provide types when
adding Finbuckle.MultiTenant and the RavenDb store.
FinbuckleRavenDbStore
implements Mcrio.Finbuckle.MultiTenant.RavenDb.Store.Interfaces.IHavePaginatedMultiTenantStore<TTenantInfo>
which can be used to retrieve a paginated tenant list.
Unique tenant identifiers are handled by the compare exchange. Compare exchange key prefixes can be modified by following:
- Extend
FinbuckleRavenDbStore
and overrideprotected virtual CompareExchangeUtility CreateCompareExchangeUtility()
to return an extendedCompareExchangeUtility
that will override the functionality for generating compare exchange key prefixes. SeeCompareExchangeUtility.GetKeyPrefix
for predefined compare exchange key prefixes.
If using the provided Finbuckle.MultiTenant.TenantInfo
class, Id
can be changed after object construction.
By default set to null
which implies HiLo identifier generation.
Refer to official RavenDB document about identifier generation strategies.
- 1.0.0 Stable version.
Nikola Josipović
This project is licensed under the MIT License. See License.md for more information.
addr1q87dhpq4wkm5gucymxkwcatu2et5enl9z8dal4c0fj98fxznraxyxtx5lf597gunnxn3tewwr6x2y588ttdkdlgaz79spp3avz
0xae0B28c1fCb707e1908706aAd65156b61aC6Ff0A