Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #4
0
        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);
        }