Used abp cli to create mvc app with SaaS turned off.
Expected: SaaS and Multi-tenant turned off
Observed: SaaS tables were present in the database, Multi-tenant feature was turned on
To reproduce see:
https://github.com/magentuseu/abp-tests
3 Answer(s)
-
0
- Solution
In ABP v10.x, the “SaaS” module and Multi-tenancy are controlled by two different things:
- SaaS module presence (adds Saas* tables) depends on whether the template includes Volo.Saas.* packages and calls builder.ConfigureSaas() in your DbContext mapping. If included, SaaS tables will be created regardless of MultiTenancy being enabled or not.
- Multi-tenancy behavior (tenant filter, tenant resolution, etc.) is controlled by AbpMultiTenancyOptions.IsEnabled or the MultiTenancyConsts.IsEnabled flag in the template.
What happened in your case:
- Creating an MVC app “with SaaS turned off” using CLI disables multi-tenancy (so the app behaves as single-tenant), but if the selected template variant still references SaaS module packages, migrations will create SaaS tables anyway. This is expected if the solution includes SaaS module; turning multi-tenancy off does not automatically remove SaaS module or its tables.
How to create a solution with both SaaS and Multi-tenancy off (no SaaS tables, no multi-tenant behavior):
- Generate the project without SaaS module:
- Use a template/option that doesn’t include SaaS. In ABP CLI, select the “without SaaS” option during creation. If you already created the solution and SaaS came in, remove it:
- Remove Volo.Saas.* package references from:
- Your .Domain, .Application, .EntityFrameworkCore, .HttpApi, .HttpApi.Host (and .Web) projects.
- Remove module dependencies:
- Delete [DependsOn(typeof(AbpSaas…))] lines from your module classes.
- Remove EF Core mappings:
- In your DbContext(s), delete builder.ConfigureSaas(); calls.
- Remove SaaS UI/menu/permissions if present.
- Delete SaaS migrations or add a new clean migration after removing mappings.
- Remove Volo.Saas.* package references from:
- Use a template/option that doesn’t include SaaS. In ABP CLI, select the “without SaaS” option during creation. If you already created the solution and SaaS came in, remove it:
- Ensure multi-tenancy is disabled:
- In your Domain.Shared project’s MultiTenancyConsts.cs: public static bool IsEnabled = false;
- Or in configuration: Configure<AbpMultiTenancyOptions>(options => options.IsEnabled = false);
- Regenerate migrations and database:
- Delete existing migrations that include Saas* tables (and the database if it was created).
- Add a new initial migration and update the database. Now no Saas* tables will be created and the application will run as single-tenant.
- Generate the project without SaaS module:
Notes for v10.1 MVC template:
- If you want single-tenant and no SaaS, the safest path is to create a template variant that doesn’t include SaaS at all. If SaaS is included by mistake, removing the packages + mappings and re-creating migrations is sufficient.
- Disabling multi-tenancy alone will not remove SaaS tables if the SaaS module is referenced.
- Sources
- https://docs.abp.io/en/abp/latest/CLI
- https://abp.io/docs/latest/framework/architecture/multi-tenancy
- https://github.com/magentuseu/abp-tests
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
The "-no-saas" arg has been used. Still, SaaS assemblies and tables were present.
-
0
hi
Can you try to use
--no-multi-tenancyforabp newcommand?Thanks.