Asp.Net Core multi-tenant application Sample using #SaaSKit
.Net Core 2.0 Support!!!
This application is upgraded to .Net Core 2.0. You can find latest releases for both .Net Core 1.x and .Net Core 2.0 in release tab.
Application Architecture
Nothing Complex.
I followed separate database per tenant approach.
In NetCoreSaaS.Data project we have three different context.
SystemDbContextholds application/system level dataCatalogDbContextholds tenant level data like tenant configurationTenantDbContextholds tenant specific data like tenant user, other tenant data
Steps to run application
- Create migration file if not created (but its already created under
Datafolder ofNetCoreSaaS.WebHost). If you want to re-create migration later checkTempFilesfolder inNetCoreSaaS.WebHostfor migration scripts. RunSystem DatabaseandCatalog Databasemigration only. - Run application. Application will itself migrate changes to database with seeding in
NetCoreSaaS_Catalogdbwith tenant data. - For testing purpose, I have configure application to listen request in host
http://*.localhost:6001(you can find configuration inProgram.csfile.) Default seeding has only added two tenant which hostname arehttp://tenant1.localhost:6001andhttp://tenant2.localhost:6001therefore request from only these two hostname will be resolved else tenant will not resolve. You can find seeding inNetCoreSaaS.WebHost > Infrastructures > Helpers > DbHelperfolder. - Once application is running, go to
http://tenant1.localhost:6001andhttp://tenant2.localhost:6001you can find same site for two virtual shop(tenants). - You can also perform user signup and login operation with these tenants.
More feature and documentation are comming...