Quantix
Quantix
CC#
Created by Quantix on 1/11/2025 in #help
"Correct" way of setting up DB for Aspire.NET MicroServices following CA
I have an Aspire.NET Project that has key services separated as MicroServices which each follow the Clean Architecture. See below an example structure:
MarketService/API
MarketService/Services
MarketService/Data

CartService/API
CartService/Services
CartService/Data

UserService/API
UserService/Services
UserService/Data
MarketService/API
MarketService/Services
MarketService/Data

CartService/API
CartService/Services
CartService/Data

UserService/API
UserService/Services
UserService/Data
The Data for each has the DTO's and the DbContexts, My problem arises where I need Migrations or to Ensure the DB is created, is there a best practice? I found an aspire-sample from Microsoft but this only has 1 DBContext where they have a separate project for it and they use A separate 'MigrationService' to handle it. I'm thinking that might be it but have no idea how to set it up with multiple DBContexts, if that's even the right idea.
18 replies