Recommend way to delete a aggregate?

Hello,

i’m playing around with the “getting-started-with-event-store” project using the CommonDomain stuff.

In my test project i’m creating a new “Customer”, relocate it, etc.

Then i want to delete it.

repository.Save(customer, Guid.NewGuid());

But i’ve also seen a “AggregateDeletedException” handling in the example project of the GetEventStoreRepository implementation. But this will only work if the stream was deleted with EventStore.DeleteStream(…). But the CommonDomain.IRepository does not have a Detele() method. Is this just a technical check or domain logic?

How do you recommend to handle to delete a aggregate?

Thanks.

Do you want the events actually deleted?

If so put a “delete” method on the repository and call the event store delete on the aggregate (note it will be permanently deleted and the space will be reclaimed). Another option is that you can soft delete it internally to the event store which is available in source and will have binaries released soon.

Hope this helps,

Greg

Hello Greg,

the wording “deleting” was a bit missleading. In the customer example its more a canceling a contract and mark it as inactive.

Just wanted to know if EventStore.DeleteStream(…) is technical or domain logic.

Well there are some legal cases where a company needs to delete all personal data of a person after canceling the contract. Intresting how to achieve, but that was not my question.

Thanks for your help.

An yes then you would add a foodeleted event and not allow operations internally eg it can be hydrated but it won’t do anything. Delete stream is a technical delete.

Cheers,

Greg