dotnet-starter-kit icon indicating copy to clipboard operation
dotnet-starter-kit copied to clipboard

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

Open Mike6x opened this issue 2 years ago • 4 comments

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

Mike6x avatar Nov 21 '24 15:11 Mike6x

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");

umutaktas avatar Nov 21 '24 22:11 umutaktas

@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

Mike6x avatar Nov 22 '24 01:11 Mike6x

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.

wibu009 avatar Nov 22 '24 07:11 wibu009

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.

iammukeshm avatar Nov 22 '24 20:11 iammukeshm