コード例 #1
0
        private async Task <SolutionStateChecksums> ComputeChecksumsAsync(CancellationToken cancellationToken)
        {
            using (Logger.LogBlock(FunctionId.SolutionState_ComputeChecksumsAsync, FilePath, cancellationToken))
            {
                // get states by id order to have deterministic checksum
                var projectChecksumTasks = ProjectIds.Select(id => ProjectStates[id].GetChecksumAsync(cancellationToken));

                var serializer   = new Serializer(_solutionServices.Workspace);
                var infoChecksum = serializer.CreateChecksum(SolutionInfo.Attributes, cancellationToken);

                var projectChecksums = await Task.WhenAll(projectChecksumTasks).ConfigureAwait(false);

                return(new SolutionStateChecksums(infoChecksum, new ProjectChecksumCollection(projectChecksums)));
            }
        }
コード例 #2
0
        public virtual IMongoQuery GetQuery(Func <string, BsonValue> getIdValue = null)
        {
            if (getIdValue == null)
            {
                getIdValue = id => new BsonObjectId(new ObjectId(id));
            }

            IMongoQuery query = Query;

            if (Ids.Count > 0)
            {
                query = query.And(MongoDB.Driver.Builders.Query.In(CommonFieldNames.Id, Ids.Select(id => getIdValue(id))));
            }
            if (OrganizationIds.Count > 0)
            {
                query = query.And(MongoDB.Driver.Builders.Query.In(CommonFieldNames.OrganizationId, OrganizationIds.Select(id => new BsonObjectId(new ObjectId(id)))));
            }
            if (ProjectIds.Count > 0)
            {
                query = query.And(MongoDB.Driver.Builders.Query.In(CommonFieldNames.ProjectId, ProjectIds.Select(id => new BsonObjectId(new ObjectId(id)))));
            }
            if (StackIds.Count > 0)
            {
                query = query.And(MongoDB.Driver.Builders.Query.In(CommonFieldNames.StackId, StackIds.Select(id => new BsonObjectId(new ObjectId(id)))));
            }

            return(query);
        }