使用RavenDB时,EventStore会抛出ConcurrencyException

时间:2013-02-14 22:54:32

标签: ravendb cqrs event-store

我的电线看起来像这样。

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: 

0 个答案:

没有答案