Migrating multi-tenancy to .NET Core 3.0

How to make the multi-tenant solution compatible with .NET Core 3.0

Introduction ASP.NET Core 3 has removed the ability to return a service provider from the ConfigureServices method, if you upgrade a project to ASP.NET Core 3 then our solution will give you a nice not supported exception on start up System.NotSupportedException: ‘ConfigureServices returning an System.IServiceProvider isn’t supported.’ Which is due to how we configure tenant specific containers - we return a custom service provider. return services.UseMultiTenantServiceProvider<Tenant>((t, c) => { c. [Read More]

Creating a multi-tenant .NET Core Application - Tenant specific authentication

Tenant specific authentication, part 4 of 4

🚨 This is not compatible with .NET Core 3.0 🚨 We cover ths changes we need to make in this post here Introduction Today we will extend our multi-tenant solution allow each tenant to have different ASP.NET Identity providers configured. This will allow differet tenants to be able to define different external identiy providers or different clients for the same identity provider. This is important to allow consent screens on third party services reflect the branding of the particular tenant that the user is signing in to. [Read More]

Creating a multi-tenant .NET Core Application - Tenant specific options

Tenant specific configuration options, part 3 of 4

🚨 This is not compatible with .NET Core 3.0 🚨 We cover ths changes we need to make in this post here Introduction Today we will extend our multi-tenant solution to work nicely with the ASP.NET Core Options Pattern. This will allow us to configure components using tenant specific configuration options. This is useful in situations where different tenants might have different settings, e.g. connection strings, cookie policies etc. [Read More]

Creating a multi-tenant .NET Core Application - Tenant containers

Tenant containers, part 2 of 4

🚨 This is not compatible with .NET Core 3.0 🚨 We cover ths changes we need to make in this post here Introduction This post looks at how to configure services on a per-tenant basis. This allows us to resolve a different service or instance based on which tenant is active. Parts in the series Part 1: Tenant resolution Part 2: Tenant containers (this post) Part 3: Options configuration per tenant Part 4: Authentication per tenant Why have tenant specific containers? [Read More]

Creating a multi-tenant .NET Core Application - Tenant resolution

Tenant resolution, part 1 of 4

Introduction This series of blog posts is an exploration of how to achieve multi-tenancy in an ASP.NET Core web application. There’s a lot of code snippets so you can follow along with your own sample app. There’s no NuGet package you can plug and play at the end of this but it is a great learning exercise. It touches a few “core” (sorry, not sorry) parts of the framework 😉 [Read More]