Asp.Net Core multi-tenant application Sample using #SaaSKit
This application is upgraded to support .Net 6.0.
Currently HTTPS
redirection is not supported.
Nothing Complex.
I followed separate database per tenant approach.
In NetCoreSaaS.Data
project, there are two different contexts.
CatalogDbContext
holds global tenant level data like tenant configurationTenantDbContext
holds tenant specific data like tenant user, other tenant related data
- Create migration file if not created (but its already created under
Data
folder ofNetCoreSaaS.WebHost
). If you want to re-create migration later checkTempFiles
folder inNetCoreSaaS.WebHost
for migration scripts. RunCatalog Database
migration only. - Run application. Application will itself migrate changes to database with seeding in
NetCoreSaaS_Catalogdb
with tenant data. - For testing purpose, I have configure application to listen request in host
http://*.localhost:6001
(you can find configuration inProgram.cs
file.) Default seeding has only added two tenant which hostname arehttp://tenant1.localhost:6001
andhttp://tenant2.localhost:6001
therefore request from only these two hostname will be resolved else tenant will not resolve. You can find seeding inNetCoreSaaS.WebHost > Infrastructures > Helpers > DbHelper
folder. - Once application is running, go to
http://tenant1.localhost:6001
andhttp://tenant2.localhost:6001
you can find same site for two tenant. - You can also perform user signup and login operation with these tenants.