lucabriguglia / OpenCQRS

.NET Standard framework to create simple and clean design. Advanced features for DDD, CQRS and Event Sourcing.
Apache License 2.0
3 stars 115 forks source link

Events saved twice in event store #94

Closed quentin-villevieille closed 4 years ago

quentin-villevieille commented 4 years ago

Hi,

I've noticed that sometimes the events get saved twice in the event store, have you ever experienced this bug ?

lucabriguglia commented 4 years ago

No, never. Are you able to reproduce it?

lucabriguglia commented 4 years ago

What store provider?

quentin-villevieille commented 4 years ago

With mongo db store provider. It's weird. It's not always the case though. I'll try to show you an example where it does so

lucabriguglia commented 4 years ago

Thanks @quentin-villevieille!

lucabriguglia commented 4 years ago

Are aggregates and commands duplicated as well or just events?

quentin-villevieille commented 4 years ago

Forget it ! I did something wrong in my code... I thought I needed to call specifically the _repository.Save(aggregate) at the end of the command handler, before returning the events, but I don't, right ?

lucabriguglia commented 4 years ago

Ah okay! No you don't need to, it's all done by the framework 😁