Giter Club home page Giter Club logo

netcoresaas's Introduction

NetCoreSaaS

Asp.Net Core multi-tenant application Sample using #SaaSKit

.Net 6.0 Support!!!

This application is upgraded to support .Net 6.0.

Known Issue

Currently HTTPS redirection is not supported.

Application Architecture

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 configuration
  • TenantDbContext holds tenant specific data like tenant user, other tenant related data

Steps to run application

  • Create migration file if not created (but its already created under Data folder of NetCoreSaaS.WebHost). If you want to re-create migration later check TempFiles folder in NetCoreSaaS.WebHost for migration scripts. Run Catalog 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 in Program.cs file.) Default seeding has only added two tenant which hostname are http://tenant1.localhost:6001 and http://tenant2.localhost:6001 therefore request from only these two hostname will be resolved else tenant will not resolve. You can find seeding in NetCoreSaaS.WebHost > Infrastructures > Helpers > DbHelper folder.
  • Once application is running, go to http://tenant1.localhost:6001 and http://tenant2.localhost:6001 you can find same site for two tenant.
  • You can also perform user signup and login operation with these tenants.

netcoresaas's People

Contributors

dependabot[bot] avatar janaks09 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

netcoresaas's Issues

file project.json

where the file project.json is localled, i need to install a depedency, but i can't find it

Web API

Will there be a sample showing how to create a multi-tenant ASP.NET Core Web API?

Project can not start

I have run the project and project gives that error below
InvalidOperationException: No service for type 'NetCoreSaaS.Data.Entities.Catalog.Tenant' has been registered.

Then I have added AddScoped Tenant to Tenant but it was a strange trial to solve it. It has stopped giving the exception but main problem is project cannot resolce localhost:60001 and tenant1 & tenant2 subdomains neither.

What did i missed to get a succeded result?

InitialTenantDbMigration

Where can i find migration for tenant?
or
How to create own migration for tenant?

obraz

OK! Found!

dotnet ef migrations add InitialTenantDbMigration -c TenantDbContext -o Data/Migrations/NetCoreSaaS/TenantDb

Where is the tenant database migrated and updated?

Maybe, I am asking a stupid question, but I cloned this project, and then I made some changes in the tenantdbcontext, because I want to save more data.

However after this, I don't know what to do, to migrate this and update this in the database.
Could anyone help me, to find this?

Dynamic Tenants

Is it possible to add tenants without restarting the app? How about the urls/hostnames? How can you add them dynamically for each dynamically created tenants?

Mistake in SeedData.cs

NetCoreSaaS/NetCoreSaaS.WebHost/Infrastructures/Helpers/DbHelper/SeedData.cs

new Tenant
{
TenantId = "14e0af40-3284-4914-bbb2-66330a24482e",
Name = "R-Shop",
HostName = "tenant1.localhost:6001",
IsEnabled = true,
Server = TenantConstant.LocalServer,
Database = "NCS_14e0af40-3284-4914-bbb2-66330a24482e",
Subscription = (int)TenantSubscription.Pro,
SubscriptionExipreDate = DateTime.UtcNow.AddYears(1), //1 year timeline for pro
DbConnectionString = TenantConstant.LocalDbConnectionString,
CreatedDate = DateTime.UtcNow,
LastUpdated = DateTime.UtcNow
}

it should be HostName = "tenant2.localhost:6001", i feel.

.NET Core Web API

Firstly, thanks for creating this sample project.

Secondly, this isn't really an issue, but it would be cool to see a .NET Core Web API sample project too.

My goal is to have a .NET Core Web API back end and either an Angular, React, or Vue front end.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.