SaaS app using .Net Core. Uses Net Core 7.0.
Currently HTTPS redirection is not supported.
Nothing Complex.
I followed a separate database per tenant approach.
In SaaSInNetCore.Data project, there are two different contexts.
CatalogDbContextholds global tenant-level data like tenant configurationTenantDbContextholds tenant-specific data like tenant user, other tenant-related data
- Create migration file if not created (but it's already created under
Datafolder ofSaaSInNetCore.Web). If you want to re-create migration later checkTempFilesfolder inSaaSInNetCore.Webfor migration scripts. RunCatalog Databasemigration only. - Run application. Application will create Catalog database (if not already created) and seed it with Tenant Data.
- For testing purposes, I have configured application to listen requests on host
http://*.localhost:6001(you can find configuration inProgram.csfile.) Default seeding only added two tenant which hostname arehttp://rshop.localhost:6001andhttp://jshop.localhost:6001therefore request from only these two hostname will be resolved else tenant will not resolve. You can find seeding inSaaSInNetCore.Web > Infrastructures > Helpers > DbHelperfolder. - Once application is running, go to
http://rshop.localhost:6001andhttp://jshop.localhost:6001you can find same site for two tenant but pointing to a different databases. - You can also perform user signup and login operations in these tenants. Those operations happens in Tenant specific database.