We have a web api c# project that was build using database-first several years ago. Now there is a need to make a transition to DDD architecture for this same project. The main reason for this is to put emphasis on business logic (that did not change a lot) and application design so it has a room to expand with new functionalities. Obviously with spaghetti code this is not so easy to do.
Since we know DDD is not just a code-first approach, but it uses a lot of different patterns and designs with domain model as it prime focus, we are looking for some answers that would make this transition as smooth as possible
- Can we build domain on top of existing db model? (since DDD should be persistence ignorant, this should be achievable)
- Can we build aggregates from existing db objects?
- Would a new project from scratch (including db) be better option?
We found related article https://www.infoq.com/news/2013/02/ddd-bounded-context-large-domain but it doesn't mention building domain on top of existing context