public async Task <IManageSessionOf <TState> > BeginSessionFor(TId id, bool throwIfNotExists = false) { var session = new EventStoreSession <TState>(configs, connection, id.ToString()); await session.Initialize(); return(session); }
public async Task <IManageSessionOf <TState> > BeginSessionFor(TId id, bool throwIfNotExists = false) { if (throwIfNotExists && !(await Contains(id))) { throw new StreamNotFoundException(id.ToString()); } var session = new EventStoreSession <TState>(configs, connection, id.ToString()); await session.Initialize(); return(session); }
public async Task <IManageSessionOf <TState> > BeginSessionFor(TId id, bool throwIfNotExists = false, DateTime?appliesAt = null) { if (throwIfNotExists && !(await Contains(id))) { throw new StreamNotFoundException(id.ToString()); } var session = new EventStoreSession <TState>(stateValidator, configs, connection, id.ToString(), dateTimeProvider); await session.Initialize(appliesAt); return(session); }
public async Task <IManageSessionOf <TState> > BeginSessionFor(TId id, bool throwIfNotExists = false, DateTime?appliesAt = null) { if (throwIfNotExists && !(await Contains(id))) { throw new StreamNotFoundException(id.ToString()); } var session = new EventStoreSession <TState>(stateValidator, configs, client, id.ToString(), dateTimeProvider); await session.Initialize(appliesAt.HasValue ?(IAmAStoredEvent e) => GetBeforeDateEventPredicate(e, appliesAt.Value) : alwaysPassPredicate); return(session); }