Пример #1
0
        public void ThrowsIfUsedByMultipleThreads()
        {
            var store = CreateStore();
            IEventStoreSession session = null;
            var wait = new ManualResetEventSlim();

            ThreadPool.QueueUserWorkItem((state) =>
            {
                session = OpenSession(store);
                wait.Set();
            });
            wait.Wait();

            User user;

            Assert.Throws <MultiThreadedUseException>(() => session.Get <User>(Guid.NewGuid()));
            Assert.Throws <MultiThreadedUseException>(() => session.Dispose());
            Assert.Throws <MultiThreadedUseException>(() => session.LoadSpecificVersion <User>(Guid.NewGuid(), 1));
            Assert.Throws <MultiThreadedUseException>(() => session.Save(new User()));
            Assert.Throws <MultiThreadedUseException>(() => session.SaveChanges());
            Assert.Throws <MultiThreadedUseException>(() => session.TryGet(Guid.NewGuid(), out user));
        }
Пример #2
0
 public virtual TAggregate GetVersion(Guid aggregateRootId, int version)
 {
     return(Aggregates.LoadSpecificVersion <TAggregate>(aggregateRootId, version));
 }