فتح مغلق

How do I setup per-schema multi-tenancy with SQL Server #5083


User avatar
0
rick@dripjobs.com خلقت

From the tooling, when I choose schema per Tenant, it creates tables called App[EntityName] with a TenantId column vs putting the tables in a schema prefix? Am I missing something in the instructions and or tooling to achieve this or is it not supported?


1 إجابة (إجابات)
  • User Avatar
    0
    maliming خلقت
    فريق الدعم Fullstack Developer

    hi

    Separate tenant schema is means:

    This solution configured so it uses two database schema;

    • Default schema is used to store host & tenant data (when the tenant uses shared database).
    • Tenant schema is used to store only the tenant data (when the tenant uses a dedicated database).

    In this way, dedicated tenant databases do not have host-related empty tables.

    To make this possible, there are two migrations DbContext in the EntityFrameworkCore project. So, you need to specify the DbContext when you want to add new migration.

    When you add/change a multi-tenant entity (that implements IMultiTenant) in your project, you typically need to add two migrations: one for the default DbContext and the other one is for the tenant DbContext. If you are making change for a host-only entity, then you don't need to add-migration for the tenant DbContext (if you add, you will get an empty migration file).

Made with ❤️ on ABP v8.2.0-preview Updated on مارس 25, 2024, 15:11