コード例 #1
0
ファイル: EventStore.cs プロジェクト: mthird/marten
        public T AggregateStream <T>(Guid streamId, int version = 0, DateTime?timestamp = null) where T : class, new()
        {
            var inner      = new EventQueryHandler(_selector, streamId, version, timestamp);
            var aggregator = _schema.Events.AggregateFor <T>();
            var handler    = new AggregationQueryHandler <T>(aggregator, inner);

            return(_connection.Fetch(handler, null));
        }
コード例 #2
0
ファイル: EventStore.cs プロジェクト: mthird/marten
        public Task <T> AggregateStreamAsync <T>(Guid streamId, int version = 0, DateTime?timestamp = null,
                                                 CancellationToken token    = new CancellationToken()) where T : class, new()
        {
            var inner      = new EventQueryHandler(_selector, streamId, version, timestamp);
            var aggregator = _schema.Events.AggregateFor <T>();
            var handler    = new AggregationQueryHandler <T>(aggregator, inner);

            return(_connection.FetchAsync(handler, null, token));
        }
コード例 #3
0
        public T AggregateStream <T>(string streamKey, int version = 0, DateTime?timestamp = null, T state = null) where T : class
        {
            ensureAsStringStorage();

            var inner      = new EventQueryHandler <string>(_selector, streamKey, version, timestamp, _store.Events.TenancyStyle, _tenant.TenantId);
            var aggregator = _store.Events.AggregateFor <T>();
            var handler    = new AggregationQueryHandler <T>(aggregator, inner, _session, state);

            var aggregate = _connection.Fetch(handler, null, null, _tenant);

            var assignment = _tenant.IdAssignmentFor <T>();

            assignment.Assign(_tenant, aggregate, streamKey);

            return(aggregate);
        }
コード例 #4
0
ファイル: EventStore.cs プロジェクト: mdissel/marten
        public T AggregateStream <T>(Guid streamId, int version = 0, DateTime?timestamp = null, T state = null) where T : class
        {
            var selector = _store.Events.EnsureAsGuidStorage(_session);

            var inner      = new EventQueryHandler <Guid>(selector, streamId, version, timestamp, _store.Events.TenancyStyle, _tenant.TenantId);
            var aggregator = _store.Events.AggregateFor <T>();
            var handler    = new AggregationQueryHandler <T>(aggregator, inner, _session, state);

            var aggregate = _session.ExecuteHandler(handler);

            var assignment = _tenant.IdAssignmentFor <T>();

            assignment.Assign(_tenant, aggregate, streamId);

            return(aggregate);
        }
コード例 #5
0
        public async Task <T> AggregateStreamAsync <T>(Guid streamId, int version = 0, DateTime?timestamp = null,
                                                       CancellationToken token    = new CancellationToken()) where T : class, new()
        {
            var inner      = new EventQueryHandler(_selector, streamId, version, timestamp);
            var aggregator = _schema.Events.AggregateFor <T>();
            var handler    = new AggregationQueryHandler <T>(aggregator, inner, _session);

            var aggregate = await _connection.FetchAsync(handler, null, token).ConfigureAwait(false);

            var assignment = _schema.IdAssignmentFor <T>();

            assignment.Assign(aggregate, streamId);


            return(aggregate);
        }
コード例 #6
0
        public async Task <T> AggregateStreamAsync <T>(string streamKey, int version = 0, DateTime?timestamp = null,
                                                       T state = null, CancellationToken token = new CancellationToken()) where T : class
        {
            ensureAsStringStorage();

            var inner      = new EventQueryHandler <string>(_selector, streamKey, version, timestamp, _store.Events.TenancyStyle, _tenant.TenantId);
            var aggregator = _store.Events.AggregateFor <T>();
            var handler    = new AggregationQueryHandler <T>(aggregator, inner, _session, state);

            var aggregate = await _connection.FetchAsync(handler, null, null, _tenant, token).ConfigureAwait(false);

            var assignment = _tenant.IdAssignmentFor <T>();

            assignment.Assign(_tenant, aggregate, streamKey);

            return(aggregate);
        }
コード例 #7
0
ファイル: EventStore.cs プロジェクト: jmbledsoe/marten
        public T AggregateStream <T>(Guid streamId, int version = 0, DateTime?timestamp = null) where T : class, new()
        {
            _tenant.EnsureStorageExists(typeof(EventStream));

            var inner      = new EventQueryHandler(_selector, streamId, version, timestamp);
            var aggregator = _store.Events.AggregateFor <T>();
            var handler    = new AggregationQueryHandler <T>(aggregator, inner, _session);

            var aggregate = _connection.Fetch(handler, null, null, _tenant);

            var assignment = _tenant.IdAssignmentFor <T>();

            assignment.Assign(_tenant, aggregate, streamId);


            return(aggregate);
        }
コード例 #8
0
ファイル: EventStore.cs プロジェクト: mdissel/marten
        public async Task <T> AggregateStreamAsync <T>(Guid streamId, int version = 0, DateTime?timestamp = null,
                                                       T state = null, CancellationToken token            = new CancellationToken()) where T : class
        {
            var selector = _store.Events.EnsureAsGuidStorage(_session);

            var inner      = new EventQueryHandler <Guid>(selector, streamId, version, timestamp, _store.Events.TenancyStyle, _tenant.TenantId);
            var aggregator = _store.Events.AggregateFor <T>();
            var handler    = new AggregationQueryHandler <T>(aggregator, inner, _session, state);

            var aggregate = await _session.ExecuteHandlerAsync(handler, token).ConfigureAwait(false);

            var assignment = _tenant.IdAssignmentFor <T>();

            assignment.Assign(_tenant, aggregate, streamId);

            return(aggregate);
        }