private async Task <ProjectionVersion> GetLiveVersion(Type projectionType) { var projectionVersionManagerId = new ProjectionVersionManagerId(projectionType.GetContractId(), context.Tenant); ProjectionDto dto = await ExploreAsync(projectionVersionManagerId, typeof(ProjectionVersionsHandler)).ConfigureAwait(false); var state = dto?.State as ProjectionVersionsHandlerState; ProjectionVersion liveVersion = state is null ? null : state.AllVersions.GetLive(); return(liveVersion); }
public async Task <ProjectionDto> ExploreAsync(IBlobId id, Type projectionType) { var result = new ProjectionDto(); var projectionResult = await projections.GetAsync(id, projectionType); if (projectionResult.IsSuccess) { result.Name = projectionType.Name; result.State = projectionResult.Data.State; } return(result); }
public async Task <ProjectionDto> ExploreIncludingEventsAsync(IBlobId id, Type projectionType) { ProjectionDto result = await ExploreAsync(id, projectionType).ConfigureAwait(false); bool projectionHasState = result.State is null == false; if (projectionHasState) { ProjectionVersion liveVersion = await GetLiveVersion(projectionType); if (liveVersion is null == false) { var commits = new List <ProjectionCommitDto>(); await foreach (var item in projectionStore.EnumerateProjectionAsync(liveVersion, id)) { commits.Add(item.ToProjectionDto()); } result.Commits = commits; } } return(result); }