fullstackhero / dotnet-starter-kit

Production Grade Cloud-Ready .NET 8 Starter Kit (Web API + Blazor Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included.
https://fullstackhero.net/dotnet-webapi-boilerplate/
MIT License
5.29k stars 1.58k forks source link

How to use seperate database for each module in project ?! #1060

Closed Mike6x closed 3 days ago

Mike6x commented 4 days ago

Hi all,

Please helpme to config each DB for each module. For example: MSSQL IdentityDB for users, CalalogDB for catalog Module. todoDB for Todo Module.

Ths

umutaktas commented 4 days ago

Hi, When you define your static Module class, you refer your service as below. This means as simple is "products table under catalog scheme "

builder.Services.AddKeyedScoped<IRepository, CatalogRepository>("catalog:products"); builder.Services.AddKeyedScoped<IReadRepository, CatalogRepository>("catalog:products");

Mike6x commented 3 days ago

@umutaktas Thank for your answer ! But I mean , how can I use MSSQL for Identity, Postgess for Catalog ..? Becase I see only one setting for connection string in AppSettings.json:

image
wibu009 commented 3 days ago

You cannot use multiple database providers simultaneously in the application. It supports only one type of database provider at runtime. For example, if you use PostgreSQL, all tenants must also use PostgreSQL. The project follows a modular monolithic architecture, so all data is stored in a single database but organized into separate schemas. If you want to use a different database for Identity, consider using an external identity provider service.

iammukeshm commented 3 days ago

As of now, we support only one db provider at a time. In future versions, will have to give each tenant the flexibility to choose it's own DB provider.