I'm designing a budgeting app using DDD and EF Core.
I have a Budget
aggregate root. It has many Transactions
and BudgetTransactionCategories
. Basically, a tree of interconnected child entities.
Now my Budget
has a Name
. Suppose I want to rename it. There is no complex invariant here. The business logic is not dependent on the Budget name and it's purely the UX feature.
To avoid partially initialized entities anti-pattern, I understand that the proper way to update the entity would be to load the whole entity tree from the database, perform some validation, update the property and save changes.
My concern is that I need to make performance concessions: either eager load, or introduce lazy loading which comes with its own set of issues. Seems an overkill for making a simple update like a rename with minimum validation (e.g. length).
If I understand the best practice correctly, I still should do this and design my aggregates in such a way that they don't get out-of-control and are not too big so I specifically don't have to worry about this.
What is the "correct" or "best" way to perform such updates? Perhaps a separate context / application for CRUD management (seems like a really bad idea though).