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)); }
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)); }
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); }
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); }
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); }
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); }
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); }
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); }