X

Multi-tenant ASP.NET Core

Writings about my work on multi-tenant ASP.NET Core web applications. I have documented here some practical solutions and approached to multi-tenancy in ASP.NET Core I’m using in real-life projects. Source code is available at Github.

Global query filters in Entity Framework Core 2.0

Entity Framework Core 2.0 introduces global query filters that can be applied to entities when model is created. It makes it easier to build multi-tenant applications and support soft deleting of entities. This blog post gives deeper overview about how to use global query filters in real-life applications and how to apply global query filters to domain entities automatically. (more…)

Implementing tenant providers on ASP.NET Core

In my previous post about global query filters in Entity Framework 2.0 I proposed an idea how to automatically apply filters to all entities so they are always coming from same tenant. This post digs deeper to possible solutions for detecting current tenant in ASP.NET Core we applications.

Implementing database per tenant strategy on ASP.NET Core

Let’s continue with multi-tenancy in ASP.NET Core web applications and focus on solutions where every tenant has its own database. It’s not only about database – there can be more services where every tenant has its own instance. It makes solution provided here easily extendable to also other services besides SQL Server or any other relational database.

Handling missing tenants in ASP.NET Core

My last post about multi-tenants applications with ASP.NET Core Implementing database per tenant strategy on ASP.NET Core I proposed some ideas about tenant providers but I didn’t focused on issues related to missing tenants. This post proposes missing tenant middleware that redirects faulty requests to some public page of company web site.

Unit testing multi-tenant database provider

My saga on supporting multiple tenants in ASP.NET Core web applications has come to point where tenants can use separate databases. It’s time now to write some tests for data context to make sure it behaves correct in unexpected situations. This post covers unit tests for data context and multi-tenancy.

Defensive database context for multi-tenant ASP.NET Core applications

In multi-tenant applications where tenants share same data store cross-tenant operations must be avoided. There are many ways how bugs like this can happen. Be it hard to debug threading issue or some other complex situation, it is better when application components are ready for this kind of situations and better fail instead of going to glory end with illegal operations. This blog post introduces defensive database context that throws exception when data from other tenants is about to be updated.

Tenant-based dependency injection in multi-tenant ASP.NET Core applications

One need in multitenant applications is injecting dependencies based on tenant configuration. It can be actually more complex as instances may need constructor parameters. Here is my example of dynamic injection of multiple file clients in ASP.NET Core multi-tenant web application.

Using configurable composite command in multi-tenant ASP.NET Core application

My previous posts about tenant-based dependency injection and using composite command in ASP.NET Core culminated with idea to use configurable composite commands in multi-tenant ASP.NET Core applications. Configurable composite commands make it easy to tweak save and update processes that contain multiple steps of what some can be custom and their activation is based on tenant configuration. Here’s how to build thost composite commands.