Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Mar 21 12:55
    chihabhajji commented #106
  • Jun 28 2021 14:45
    solopromiguel edited #106
  • Jun 28 2021 14:44
    solopromiguel edited #106
  • Jun 28 2021 14:44
    solopromiguel edited #106
  • Jun 28 2021 14:44
    solopromiguel opened #106
  • Apr 28 2020 11:46
    win32nipuh opened #105
  • Feb 27 2020 20:48
    anthrax3 opened #104
  • Apr 15 2019 02:16
    project-orcon commented #96
  • Apr 08 2019 06:23
    MuratGOZCU closed #103
  • Apr 07 2019 21:13
    Marcel0024 commented #103
  • Jan 21 2019 07:26
    MuratGOZCU opened #103
  • Jan 21 2019 07:19
    MuratGOZCU closed #102
  • Jan 19 2019 22:48
    aldari closed #92
  • Jan 17 2019 04:22
    aceptra closed #53
  • Dec 12 2018 13:24
    MuratGOZCU edited #102
  • Dec 12 2018 13:24
    MuratGOZCU opened #102
  • Dec 05 2018 13:23
    chernihiv commented #96
  • Nov 07 2018 14:14
    flauberjp commented #96
  • Sep 18 2018 16:33
    grayniall commented #96
  • Aug 10 2018 18:46
    ani2479 opened #101
I am using multi tenancy with multi database.
  1. Master DB
2 TenantDB - 1
3 TenantDB -2
I have successfully mapped all the tenant with Host and also successfully able to call all the existing different tenant databases.
My question is support i am logged with MasterDB - host : localhost:9000 and i want to access all the data of TenantDB - 1(host : localhost:9001) and TenantDB-2 (host: localhost:9002) when i am logged in with the MasterDB.
Please let me know how do i achieve this as the tenant context is already binded with MasterDB database.
I am trying to built a multi tenant application with separate database for each tenant. Can any one help me how do I configure dbcontext based on tenant.
I'm running two ASP.NET Core MVC webb apps on my localhost and both applications is using cookies. Should CookieDomain separation of cookies be working if I specify custom domain names in my hosts file?
Hi guys (and girls), does NLog.Web have support for .NET Standard?
It seems it doesn't have support, so what to do?
I have a class library using .NET standard library 2.0 which have a type inheriting the AspNetLayoutMultiValueRendererBase
Eric Gitonga Njue

Maybe this question has been answered, if so I would appreciate a link to it.
I want to load the tenants from a Db & create their respective databases (Each tenant to have their own database). I've tried overriding my DbContext onConfiguring but tenant is always null. See below code,

` public class CounterServeDefaultDbContext : DbContext
private readonly AppTenant tenant;

    public CounterServeDefaultDbContext(AppTenant tenant)
        this.tenant = tenant;

    #region DbSets

    public DbSet<AppTenantTuple> AppTenants { get; set; }


    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
} `

StartUp Class

` public void ConfigureServices(IServiceCollection services)
services.AddMultitenancy<AppTenant, AppTenantResolver>();


        // AddAuthentication adds the authentication services to DI and configures "Bearer" as the default scheme
            // AddIdentityServerAuthentication adds the IdentityServer access token validation handler into DI for use by the authentication services
            .AddIdentityServerAuthentication(options =>
                options.Authority = AUTHORITY;
                options.RequireHttpsMetadata = false;
                options.ApiName = "***";


        services.AddSingleton<IConfigureOptions<MultitenancyOptions>, ConfigureMultitenancyOptions>();

        // services.Configure<MultitenancyOptions>(Configuration.GetSection("Multitenancy"));

Just wondering if anyone has had success getting a saaskit Multi-Tenant app working in Azure using subdomains. if so, any pointers?
@EssentialAgility sure, using custom domains. Where did u get stuck?
Marcin Sulecki

Hi, I've just started using SaasKit.Multitenancy library. I'm looking for a way for Per-Tenant Options. Somethink like that in Finbuckle.MultiTenant:

    .WithPerTenantOptionsConfig<CookieAuthenticationOptions>((o, tenantContext) =>
        o.Cookie.Name += tenantContext.Id;

How can you do it with SaasKit.Multitenancy?

Michael Dadashyan
Hello @benfoster , I am trying to use the SaasKit and following the blogpost http://benfoster.io/blog/aspnet-core-multi-tenancy-data-isolation-with-entity-framework.
Got stuck where I want to inject Tenant to DbContext to change the connection string.
I am getting error: InvalidOperationException: No service for type 'Models.Tenant' has been registered..
Injection to view works just fine.
My DbContext is in different assembly if it matter
Hello team
I have the same question @mebymyself has if anyone has a link to the solution please provide
i have a requirement mulitple clients login independently with same login credentials for different clients(websites) . Is this possible with identity server 4?
Edwardenis De los santos
This Awasome Library is for .net core so I cannot used. Do you know an alternative to implement on MVC 5 App?
Ben Meredith
@Edwardenis The 0.0.2-pre version of SaasKit uses full framework (MVC 5/WebApi 2) instead of .net core.
Alan Leite de Rezende

Good morning guys!
I need to implement the filters in my services to get the data of the tenance you are requesting.
Given this scenario, will I have to inject the tenance resolver into my service and do a where in all methods manually, or is there any native saaskit implementation that solves this?

Example Today:
var accounts = _accountAppService.GetAsync (). Where (x => x.tenantId == _tenantResolver.Id)

Master Whiz
@alanrezendee You should inject the TenantContext that holds the Tenant object instead of injecting the tenant resolver
@sulmar Where you able to create this function 'WithPerTenantOptionsConfig' or something similar?
Is this channel still active ?
Márton Balassa
Hi, is this project active in any way? I like the idea and I have some of my own to contribute.
Reagan Chu
I'm trying to dding tenant-specific files with SaasKit in ASP.NET Core

and can't find any working example for core 2.0
this was the old code for core 1.0

var routeBuilder = new RouteBuilder(app);
var routeTemplate = "tenant/{*filePath}";
routeBuilder.MapRoute(routeTemplate, (IApplicationBuilder fork) =>
//Add middleware to rewrite our path for tenant specific files
var router = routeBuilder.Build();

but core 2.0 no longer use this. is there anyone with example on how to get this to work

Joe Audette
@presiden999_twitter I would avoid rewriting and instead if tenant routes need a folder segment in the url use a routecontstraint, that is what we do in cloudscribe, we do use sasskit to resolve the tenant per request and we use it to branch static files middleware per tenant, but most other middleware is singleton and can't be branched in 2.0 and higher. https://www.cloudscribe.com/
Master Whiz
Hi, has anyone used SaasKit in ASP.NET Core 3.0?
hi has anyone done any multitenancy handling events, eg event property sets tenant ?
Does saaskit use websockets?
Sanchit Chawla
I am using SAAS Kit and loading tenant information from an external data source, I am planning to implement CachingAppTenantResolver to avoid calling database on every request. But just wanted to check how would i invalidate the cache if tenant is updated/deleted
this project seems semi-dead. anything better, or at least maintained, out there? I know of cloudscribe from above.
Jeremy Cook
@whizkidwwe1217 I just created a project ASP.NET Core 3.0 project and used it by following the https://benfoster.io/blog/asp-net-5-multitenancy tutorial. It worked fine.
Master Whiz

@jeremycook Yes, it works in 3.0 but you can't override the default dependencies per tenant (https://benfoster.io/blog/asp-net-core-dependency-injection-multi-tenant). In ASP.NET Core 3.0, the way you override ConfigureServices is different. The SaasKit.Multitenancy.StructureMap extension doesn't work in 3.0 anymore. Seems like Microsoft removed the feature (aspnet/AspNetCore#5949).

In 2.2, you can override the ConfigureServices and configure the dependencies per tenant as shown in the code below:

public IServiceProvider ConfigureServices(IServiceCollection services)
          var container = new Container();
          container.ConfigureTenants<AppTenant>((tenant, config) =>
                    if (tenant.Db == 'MSSQL')
          return container.GetInstance<IServiceProvider>();
I hope someone can migrate it to 3.0. That would be a big help.
I'm using that feature and it prevents me from updating to ASP.NET Core 3.0.
Jeremy Cook
@whizkidwwe1217 I've used AddScoped and AddTransient to achieve about the same result, and not worried about the lack of a "tenant" scope. For example:
services.AddScoped<IRepository>(serviceProvider => {
    var tenant = serviceProvider.GetRequiredService<AppTenant>();
    if (tenant.Db == "MSSQL")
        return serviceProvider.GetRequiredService<MsSqlRepository>();
        return serviceProvider.GetRequiredService<MySqlRepository>();
Paul Czywczynski
@slacker-king Might checkout this: https://www.finbuckle.com/MultiTenant
Struggling to find a solution mentioned here though I note somebody else mentioned a similar problem. I am in the process of migrating dotnetcore from 1.0 through all iterations to 3.1. SaasKit app.UsePerTenant<AppTenant>((ctx, builder) => needs moving to services.addmultitenancy - but I can not find any examples. I'm focused mainly on the cookie based authentication as shown here: https://docs.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/identity-2x?view=aspnetcore-3.1
@asest I have tried saaskit but it seems it died. I use the https://www.finbuckle.com/MultiTenant, it is live project, the author develops it and react on issues.
hi all im new in this room and im interst with saaskit , in our project we wnat to apply saas with some needed , first app have to create database when add new tenant , each tenent have its owin users , in back office we will collect the data in table [TABLE1] from each tenant database table TABL1 in master database . So can i do this scenario in SAASkit please feedback, its important
someone managed to authenticate by token per tenant?
I'm working on a Multi Tenant multiple database project with a GlobalDBContext containing all the tenants with their connection strings that is used by the TenantResolver to set the proper connection string into the AppTenant, and a TenantDbContext that is dependent on AppTenant for the connection string.
I'm wondering if there is a way to decouple the TenantDbContext from the AppTenant and therefore removing the override on OnConfiguring method in the DbContext
I'd like to be able to use the default DbContextOptionsBuilder to pass in the options for configuring the connection.
I need to use the same TenantContext outside of the ASP.Net process where I don't have the HttpContext that is required by the TenantResolver.
hello, I am trying saaskit on blazor I'm following the theme-able guide https://benfoster.io/blog/asp-net-core-themes-and-multi-tenancy/ do you happen to have the full gulp.js file?
Black Aerosmith
Hi All, I'm a Product Owner building a SaaS product. I came here from Ben Foster blog (seemed like he was talking about my life lol). I'm at a similar crossroad: we are moving from an instance-based structure to multi-tenancy; and struggling with what framework to use - any suggestions please? The application is build on PHP Laravel. (Backend)