Skip to content

SqlServerEventStore loads all events >= sequence number of snapshot #29

@flumlopp

Description

@flumlopp

Hello,

I was looking at the code from the MongoDb and SqlServer EventStore and realized that the GetEvents method of the former returns all events with a sequence number bigger than the snapshot's LastEventSequence, while the later returns all events with sequence number bigger or equal.

SimpleCqrs.EventStore.MongoDb.MongoEventStore:
where domainEvent.Sequence > startSequence

SimpleCqrs.EventStore.SqlServer.SqlStatements:
internal const string GetEventsByAggregateRootAndSequence = "select eventtype, data from {1} where aggregaterootid = '{2}' and sequence >= {3}";

The consequence of this might be that an event handler tries to change the state of the aggregate root which already accounts for this change. Possibly making validation of business rules invalid.

I'm not sure if my interpretation is correct, so I appreciate any feedback on this.

Thank You,
Mathias

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions