public async Task <bool> IsIncrementalUpdateAsync(Checksum newSolutionChecksum) { var newSolutionChecksums = await _assetProvider.GetAssetAsync <SolutionStateChecksums>(newSolutionChecksum, _cancellationToken).ConfigureAwait(false); var newSolutionInfo = await _assetProvider.GetAssetAsync <SolutionInfo.SolutionAttributes>(newSolutionChecksums.Attributes, _cancellationToken).ConfigureAwait(false); // if either solution id or file path changed, then we consider it as new solution return(_baseSolution.Id == newSolutionInfo.Id && _baseSolution.FilePath == newSolutionInfo.FilePath); }
public async Task SynchronizeSolutionAssetsAsync(Checksum solutionChecksum, CancellationToken cancellationToken) { using (await s_gate.DisposableWaitAsync(cancellationToken).ConfigureAwait(false)) { // this will make 4 round trip to data source (VS) to get all assets that belong to the given solution checksum // first, get solution checksum object for the given solution checksum var solutionChecksumObject = await _assetProvider.GetAssetAsync <SolutionStateChecksums>(solutionChecksum, cancellationToken).ConfigureAwait(false); // second, get direct children of the solution await SynchronizeAssets_NoLockAsync(solutionChecksumObject.Children, cancellationToken).ConfigureAwait(false); // third and last get direct children for all projects and documents in the solution await SynchronizeProjectAssets_NoLockAsync(solutionChecksumObject.Projects, cancellationToken).ConfigureAwait(false); } }
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); }