2

我的电线看起来像这样。

return Wireup.Init()
      .UsingRavenPersistence("RavenDB")
      .ConsistentQueries()
      .InitializeStorageEngine()
      .UsingJsonSerialization()
      .Build();

当我尝试保存事件时,如下所示:

using (eventStore)
using (var stream = eventStore.CreateStream(myEvent.AggreagateId))
{
    stream.Add(new EventMessage { Body = myEvent });
    stream.CommitChanges(myEvent.Id);
}

它抛出一个EventStore.ConcurrencyException

我正在使用 eventstore 3.0 和 RavenDB 2.0

我究竟做错了什么?

这是堆栈跟踪:

EventStore.ConcurrencyException was unhandled by user code
  HResult=-2146233088
  Message=Exception of type 'EventStore.ConcurrencyException' was thrown.
  Source=EventStore.Persistence.RavenPersistence
  StackTrace:
       at EventStore.Persistence.RavenPersistence.RavenPersistenceEngine.Commit(Commit attempt) in c:\Code\public\EventStore\src\proj\EventStore.Persistence.RavenPersistence\RavenPersistenceEngine.cs:line 135
       at EventStore.OptimisticEventStore.Commit(Commit attempt) in c:\Code\public\EventStore\src\proj\EventStore.Core\OptimisticEventStore.cs:line 98
       at EventStore.OptimisticEventStream.PersistChanges(Guid commitId) in c:\Code\public\EventStore\src\proj\EventStore.Core\OptimisticEventStream.cs:line 166
       at EventStore.OptimisticEventStream.CommitChanges(Guid commitId) in c:\Code\public\EventStore\src\proj\EventStore.Core\OptimisticEventStream.cs:line 147
       at TeamHabits.Web.Habit.CreateHabitModule.<>c__DisplayClass6.<.ctor>b__1(Object _) in c:\Users\Emil\Dropbox\Active projects\TeamHabits\Source\TeamHabits.Web\Habit\CreateHabitModule.cs:line 41
       at Nancy.Routing.Route.Invoke(DynamicDictionary parameters)
       at Nancy.Routing.DefaultRouteInvoker.Invoke(Route route, DynamicDictionary parameters, NancyContext context)
       at Nancy.Routing.DefaultRequestDispatcher.Dispatch(NancyContext context)
  InnerException: 
4

0 回答 0