Skip to content

mcrio/Mcrio.Finbuckle.MultiTenant.RavenDb.Store

Repository files navigation

RavenDB

Finbuckle Multitenant

Finbuckle Multi-Tenant on RavenDB

Build status Nuget

RavenDB implementation of the Finbuckle.MultiTenant store.

What is Finbuckle Multi-Tenant

Finbuckle.MultiTenant is open source multi-tenancy middleware for .NET. For more information about Finbuckle.MultiTenant visit the official website.

Getting Started

NuGet Package

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>

Usage

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
    )

Custom Tenant info data

Extend Finbuckle.MultiTenant.TenantInfo or Finbuckle.MultiTenant.ITenantInfo and provide types when adding Finbuckle.MultiTenant and the RavenDb store.

Paginated results

FinbuckleRavenDbStore implements Mcrio.Finbuckle.MultiTenant.RavenDb.Store.Interfaces.IHavePaginatedMultiTenantStore<TTenantInfo> which can be used to retrieve a paginated tenant list.

Compare Exchange key prefixes

Unique tenant identifiers are handled by the compare exchange. Compare exchange key prefixes can be modified by following:

  • Extend FinbuckleRavenDbStore and override protected virtual CompareExchangeUtility CreateCompareExchangeUtility() to return an extended CompareExchangeUtility that will override the functionality for generating compare exchange key prefixes. See CompareExchangeUtility.GetKeyPrefix for predefined compare exchange key prefixes.

ID generation

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.

Release History

  • 1.0.0 Stable version.

Meta

Nikola Josipović

This project is licensed under the MIT License. See License.md for more information.

Do you like this library?

₳ ADA | Buy me a coffee or two :)
addr1q87dhpq4wkm5gucymxkwcatu2et5enl9z8dal4c0fj98fxznraxyxtx5lf597gunnxn3tewwr6x2y588ttdkdlgaz79spp3avz

Ξ ETH | ...a nice cold beer :)
0xae0B28c1fCb707e1908706aAd65156b61aC6Ff0A

฿ BTC | ...or maybe a good read :)
bc1q3s8qjx59f4wu7tvz7qj9qx8w6ktcje5ktseq68

Happy if you stake ADA with Pale Blue Dot [PBD]
https://palebluedotpool.org
 

About

RavenDB implementations of the Finbuckle.MultiTenant store.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages