It would be beneficial if the Repository interface would contain an API call to verify whether a given 'aggregate identifier' is already present for the given Aggregate.
Such a feature would alleviate users from the following use case fore example:
Maybe idempotent aggregate creation could be a feature of the command bus ? If enabled, it would ignore the PK violation upon aggregate insert, because that's really the only way to know if the aggregate already exists or not. The repository API call is nice but it doesn't give you any guarantees, it AR could be created just after...
This issue was in essence created to support a create or update approach when it comes to an Aggregate's command handler.
Is such, it's (firstly) a duplicate of #681, but more importantly it's thus already superseded by the implementation built in pull request #1281.
Due to this, I will be closing this issue as "duplicate" and "obsolete".
Most helpful comment
Maybe idempotent aggregate creation could be a feature of the command bus ? If enabled, it would ignore the PK violation upon aggregate insert, because that's really the only way to know if the aggregate already exists or not. The repository API call is nice but it doesn't give you any guarantees, it AR could be created just after...