public static User Register(IEventStoreSession aggregates, string email, string password, Guid id) { var user = new User(); user.Register(email, password, id); aggregates.Save(user); return(user); }
public static MyAccount Register(IEventStoreSession aggregates, Guid accountId, string email, string password) { var registered = new MyAccount(); registered.RaiseEvent(new AccountRegisteredEvent(accountId, email, password)); aggregates.Save(registered); return(registered); }
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)); }
public virtual void Add(TAggregate aggregate) { Aggregates.Save(aggregate); }