-
Notifications
You must be signed in to change notification settings - Fork 708
Description
So, I have this demo project where all of the apps use the same database.
I want to use the containers database easily configured by the Distributed Builder, however, the database requires some initial data inserted like supported cultures, default roles, etc.
Basically I need to do the following before the apps start
- Start the Database container
- Instantiate a DbContext
- Invoke EnsureDatabaseCreate methods
- Insert the data using the SqlRaw methods
I have done all of that from each app, the problem I have is that, since I have no control of the order in which they start, it works sometimes others it throws errors.
This is the sample host I currently have:
https://github.com/pticostaricags/FairPlayCombined/blob/main/src/FairPlayCombinedSln/FairPlayCombinedSln.AppHost/Program.cs
When I have tried to do it from the AppHost I get error like the one in the second screenshot
Screenshot 1

Is there any way I could do the mentioned configuration before the applications start?
Even more than that, as for my knowledge, my attempt would probably work only for development environment, but what would be the recommended approach for having auto-configured containers, when you have multiple apps or microservices using the same database container, and that would actually work for a deployed platform.

