Not sure if it's worth sharing or not but here it is any way :p It was
built just to get things going so the implementation is very
simplistic. I will share the Raven DB event store when I get it
finished.
public class InMemoryEventStore : IEventStore
{
private readonly Dictionary<Guid, List<HistoricalEvent>>
_events = new Dictionary<Guid, List<HistoricalEvent>>();
public IEnumerable<HistoricalEvent>
GetAllEventsForEventSource(Guid id)
{
return _events[id];
}
public IEnumerable<IEvent> Save(EventSource source)
{
if (!_events.ContainsKey(source.Id) || _events[source.Id]
== null)
_events[source.Id] = new List<HistoricalEvent>();
var events = source.GetUncommitedEvents();
events.ToList().ForEach(e => _events[source.Id].Add(new
HistoricalEvent(DateTime.Now, e)));
return events;
}
}
On Aug 13, 8:40 am, Pieter Joost van de Sande
<
pjvandesa...@born2code.net> wrote:
> Cool! Is the in memory one worth sharing? And for the choice of an event store, RavenDB has better transaction support then MongoDB.
>
> * Verstuurd vanaf de iPhone
>