entityframework-dotnet-single-db

Configure a shared single database with automatic tenant filtering for Jarvis EF Core SaaS applications.

12|2|Updated May 4, 2020
One-click install
npx skills add https://github.com/hoangnh2412/jarvis --skill entityframework-dotnet-single-db
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: entityframework-dotnet-single-db
Source: https://github.com/hoangnh2412/jarvis/tree/main/.opencode/skills/entityframework-dotnet/patterns/single-db
Command: npx skills add https://github.com/hoangnh2412/jarvis --skill entityframework-dotnet-single-db

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the problem of complex multi-tenant database configuration for small to medium SaaS applications built with the Jarvis EF Core framework, eliminating the operational overhead of managing separate databases per tenant.

Core Features & Use Cases

  • Simplified DI Registration: Registers a single generic AppDbContext with a fixed connection string, no complex interceptors required for setup.
  • Automatic Tenant Data Filtering: Uses global query filters via the ITenantEntity interface to automatically scope all data access to the current tenant, using identifiers from the X-Tenant-Id header, claims, query parameters, or host values.
  • Use Case: Ideal for small to medium SaaS applications where shared database architecture reduces operational complexity compared to per-tenant database isolation models.

Quick Start

Use this skill to configure a shared multi-tenant database with automatic tenant filtering for your Jarvis EF Core ASP.NET Core SaaS application.

Frequently Asked Questions about entityframework-dotnet-single-db

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure a shared multi-tenant database with EF Core in a SaaS application?

Configure a shared multi-tenant EF Core database by registering a generic AppDbContext with a fixed connection string and implementing global query filters to scope data access via tenant identifiers. This approach simplifies DI registration without complex interceptors.

How does automatic tenant data filtering work with Entity Framework Core?

Automatic tenant data filtering in EF Core uses global query filters on ITenantEntity instances to restrict data access based on current tenant identifiers. These identifiers are extracted from the X-Tenant-Id header, claims, query parameters, or host values.

When should I use a shared single database instead of per-tenant database isolation for SaaS?

Use a shared single database for small to medium SaaS scenarios where operational simplicity is prioritized over strict database isolation. This model eliminates the overhead of managing separate databases per tenant while maintaining data segregation through query filtering.

How do I register an AppDbContext with a fixed connection string for multi-tenant SaaS?

Register an AppDbContext with a fixed connection string by using simplified dependency injection setup. This registers a single generic database context for the entire SaaS application, removing the need for complex interceptor configurations during initialization.

What are the limitations of using a shared database architecture for multi-tenant SaaS applications?

The limitation of a shared database architecture for multi-tenant SaaS is the lack of per-tenant database isolation. This approach prioritizes operational simplicity and is suitable for small to medium scenarios, but may not meet strict data isolation requirements for larger enterprise tenants.

Can I use tenant identifiers from HTTP headers to filter data in EF Core?

Yes, you can filter data in EF Core using tenant identifiers extracted from HTTP headers like X-Tenant-Id. The framework also supports resolving tenant context from claims, query parameters, or host values to automatically apply global query filters.