-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/financial years #180
Conversation
Commands/Handlers/FinancialYear/AddFinancialYear/AddFinancialYearCommand.cs
Outdated
Show resolved
Hide resolved
Commands/Handlers/FinancialYear/AddFinancialYear/AddFinancialYearHandler.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also missing an EFCore migration. I'm also wondering whether FInancialYear should become an AggregateRoot whjch owns many Transaction objects. The it is now, they would become 2 aggregate roots with relations between them, which is generally frowned upon in DDD.
A better would be to make FinanalYear the aggregate root, and make the current Transaction aggregate root, a value object of a financial year instead. In this case the TransactionRepository would need to be removed, and each interaction with a transaction would need to take please through the FinancialYear.
In this an EFCore configuration using OwnsMany(y => y.Transactions)
would be needed from the FinancialYear config
This reverts commit 686d8d8. # Conflicts: # Domain/Transaction.cs
I was opting for that last path too, but I did want to have this discussed. From a domain point of view, this approach makes to most sense. So: FinancialYear becomes the new aggregate root, Transaction is removed and becomes a value object of that newly created aggregate root. The reason I didnt yet create a migration was to prevent too many up and down migrations during development. |
Indeed that would impose a breaking change in that transactions could not be accessed by themselves, but would need to be accessed through their FY aggregate root. |
I've updated the PR. No migrations yet, but I think the domain change has been done. However, some other issues I'm not sure if the current implementation is the best:
|
I think the DbSet will have to go anyway, because iirc an entity cannot have both it's own DbSet as well as be owned by another entity. |
I knew this would happen: owned types don't support hierarchy (https://learn.microsoft.com/en-us/ef/core/modeling/owned-entities#current-shortcomings). |
I'm still in doubt about the domain model of the FinancialYear.
I've added some unit tests nonetheless, so we can still change the implementation.