Beispiel #1
0
            private async Task <Dictionary <ProjectId, ProjectStateChecksums> > GetProjectMapAsync(
                AssetProvider assetProvider,
                HashSet <Checksum> projects
                )
            {
                var map = new Dictionary <ProjectId, ProjectStateChecksums>();

                var projectChecksums = await assetProvider
                                       .GetAssetsAsync <ProjectStateChecksums>(projects, _cancellationToken)
                                       .ConfigureAwait(false);

                var infos = await assetProvider
                            .GetAssetsAsync <ProjectInfo.ProjectAttributes>(
                    projectChecksums.Select(p => p.Item2.Info),
                    _cancellationToken
                    )
                            .ConfigureAwait(false);

                foreach (var kv in projectChecksums)
                {
                    var info = await assetProvider
                               .GetAssetAsync <ProjectInfo.ProjectAttributes>(
                        kv.Item2.Info,
                        _cancellationToken
                        )
                               .ConfigureAwait(false);

                    map.Add(info.Id, kv.Item2);
                }

                return(map);
            }
            private static async Task <Dictionary <DocumentId, DocumentStateChecksums> > GetDocumentMapAsync(AssetProvider assetProvider, HashSet <Checksum> documents, CancellationToken cancellationToken)
            {
                var map = new Dictionary <DocumentId, DocumentStateChecksums>();

                var documentChecksums = await assetProvider.GetAssetsAsync <DocumentStateChecksums>(documents, cancellationToken).ConfigureAwait(false);

                var infos = await assetProvider.GetAssetsAsync <DocumentInfo.DocumentAttributes>(documentChecksums.Select(p => p.Item2.Info), cancellationToken).ConfigureAwait(false);

                foreach (var kv in documentChecksums)
                {
                    Debug.Assert(assetProvider.EnsureCacheEntryIfExists(kv.Item2.Info), "Expected the prior call to GetAssetsAsync to obtain all items for this loop.");

                    var info = await assetProvider.GetAssetAsync <DocumentInfo.DocumentAttributes>(kv.Item2.Info, cancellationToken).ConfigureAwait(false);

                    map.Add(info.Id, kv.Item2);
                }

                return(map);
            }