jonsequitur / Its.Cqrs

A set of libraries for CQRS and Event Sourcing, with a Domain-Driven Design flavor.
Other
77 stars 21 forks source link

When scheduling a ConstructorCommand, it's possible for the command AggregateId to not match the scheduler target AggregateId #182

Closed jonsequitur closed 7 years ago

jonsequitur commented 7 years ago

This is a gotcha, where is's possible to do the following:

await scheduler.Schedule( 
    aggregateId1, 
    new SomeCtorCommand { 
        AggregateId = aggregateId2
    } );

If aggregateId2 is unspecified, ConstructorCommand<T> will create a random one, with a similar result to the above.

This doesn't result in an error. The new aggregate is created using aggregateId2, which can be very confusing.