elliotritchie/NES — pull request #23 by marinkobabic (2014-03-16 22:25:23+00:00)
Title: add sortfilteraction for events and getevents

In DDD we have scenarios where we need access to the events to be able to filter and/or sort them before hydration. Here some examples:

We have an event which is send today, but has affect on the data in the past. This is often the case in an accounting system. So we need to sort the items depending on the date of the event and not the sequence on the eventstore database.

A possible way to implement roles. As example we can have a person. The person can be an inhabitant or an external person. The id of the person remains independing of the role. So we could have two aggregates "inhabitant" and "externalperson" which share the same event stream. To be able to separate the events related to the role we have a state property as a part of the event. When hydrating the "inhabitant" aggregate we only want to hydrate events which the "inhabitant" state. (State pattern is not an option because we have to many different methods in both roles)

What are your thoughs?