public void Handle(RegisterProjection command) { ProjectionVersionManager ar; if (Repository.TryLoad(command.Id, out ar) == false) { ar = new ProjectionVersionManager(command.Id, command.Hash); } else { ar.NotifyHash(command.Hash); } Repository.Save(ar); }
public async Task HandleAsync(RegisterProjection command) { ProjectionVersionManager ar = null; ReadResult <ProjectionVersionManager> result = await repository.LoadAsync <ProjectionVersionManager>(command.Id).ConfigureAwait(false); if (result.IsSuccess) { ar = result.Data; ar.NotifyHash(command.Hash, projectionVersioningPolicy); } if (result.NotFound) { ar = new ProjectionVersionManager(command.Id, command.Hash); } await repository.SaveAsync(ar).ConfigureAwait(false); }