Skip to content

Tenant-Isolated EF Core Repositories on Par with MongoDB Multi-Tenancy #71

@tsutomi

Description

@tsutomi

"Give teams building multi-tenant applications on relational databases the same one-API, zero-leakage tenancy experience that MongoDB users have today."

The Problem Today
Deveel.Repository.MongoFramework.MultiTenant provides a robust connection-per-tenant isolation model. The EF Core driver has no equivalent: teams building multi-tenant applications on SQL Server or PostgreSQL must implement tenant filtering manually through EF Core global query filters or per-query predicates — with no repository-level convention, tooling, or isolation guarantees from the framework.

What We Are Building

  • An IDbTenantContext service that provides the current tenant identifier to the EF Core driver
  • Automatic global query filter registration for entities implementing IHaveOwner<TTenantId> — no per-query filtering required
  • A schema-per-tenant strategy option routing each tenant to a named database schema
  • A database-per-tenant strategy option using tenant-specific connection strings, paralleling the MongoDB model
  • An integration adapter for Finbuckle.MultiTenant (the de-facto .NET multi-tenancy library)

Benefits

  • SQL-backed multi-tenant applications use the same repository API as single-tenant ones
  • Zero cross-tenant data leakage — isolation is enforced at the driver level, not trusted to application code
  • Teams already using Finbuckle.MultiTenant get native integration without any glue code
  • Feature parity with MongoDB multi-tenancy — driver choice no longer dictates multi-tenancy capability

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions