public async Task Handle(long streamPosition, ProjectEvents.ProjectCreated @event, CancellationToken stoppingToken)
        {
            var eventAudit = CreateEventAudit(streamPosition, @event);
            var storeKey   = Projection.StoreKey(@event.Id);

            var project = Model.Project.Create(eventAudit, @event.Id, @event.Name);

            var projection = Projection.Create(eventAudit, project);
            await Projections.Create(storeKey, projection).ConfigureAwait(false);
        }
Exemple #2
0
        public async Task Handle(long streamPosition, ProjectEvents.ProjectCreated @event, CancellationToken stoppingToken)
        {
            var eventAudit = CreateEventAudit(streamPosition, @event);
            var storeKey   = Projection.StoreKey(@event.AccountId);
            var account    = (await Projections.Get(storeKey).ConfigureAwait(false)).Account;

            account.SetProjectName(eventAudit, @event.Id, @event.Name);

            var projection = Projection.Create(eventAudit, account);
            await Projections.Update(storeKey, projection).ConfigureAwait(false);
        }