I like to organise packages in my solutions to correspond three classical onion architecture layers:
- domain
- application
- infrastructure
Let's consider an example exchange application which calculates stock prices. This example application might need some initial data of companies which are available. The companies must be understandable for the domain, of course. I know that i should have only business rules in the domain package, however the business won't live without this initial collection of companies. Most of tutorials i've experienced have this data somewhere in the infrastructure and it's dependencies. For example someone configures the persistency and somewhere in there adds some records or whatever to the database. I've created a static collection of all aggregates needed to be persisted before running the application in the domain package. Then referenced them in the infrastructure package to execute insert logic on application start. Is it correct approach? If not, please explain what am i doing wrong? Regards