Esempio n. 1
0
        public Task <IEnumerable <ProviderSourceDatasetHistory> > GetProviderSourceDatasetHistories(string specificationId, string relationshipId)
        {
            CosmosDbQuery cosmosDbQuery = new CosmosDbQuery
            {
                QueryText  = @"SELECT *
                            FROM    r 
                            WHERE   r.content.specificationId = @SpecificationId
                                    AND r.content.dataRelationship.id = @RelationshipId
                                    AND r.deleted = false
                                    AND r.documentType = @DocumentType",
                Parameters = new[]
                {
                    new CosmosDbQueryParameter("@SpecificationId", specificationId),
                    new CosmosDbQueryParameter("@RelationshipId", relationshipId),
                    new CosmosDbQueryParameter("@DocumentType", nameof(ProviderSourceDatasetHistory))
                }
            };

            return(_cosmosRepository.QuerySql <ProviderSourceDatasetHistory>(cosmosDbQuery, -1));
        }
        public Task <IEnumerable <ProviderSourceDatasetHistory> > GetProviderSourceDatasetHistories(string specificationId, string relationshipId)
        {
            SqlQuerySpec sqlQuerySpec = new SqlQuerySpec
            {
                QueryText  = @"SELECT *
                            FROM    r 
                            WHERE   r.content.specificationId = @SpecificationId
                                    AND r.content.dataRelationship.id = @RelationshipId
                                    AND r.deleted = false
                                    AND r.documentType = @DocumentType",
                Parameters = new SqlParameterCollection
                {
                    new SqlParameter("@SpecificationId", specificationId),
                    new SqlParameter("@RelationshipId", relationshipId),
                    new SqlParameter("@DocumentType", nameof(ProviderSourceDatasetHistory))
                }
            };

            return(_cosmosRepository.QuerySql <ProviderSourceDatasetHistory>(sqlQuerySpec, -1, enableCrossPartitionQuery: true));
        }
Esempio n. 3
0
        public async Task <IEnumerable <FundingStreamPermission> > GetUsersWithFundingStreamPermissions(string fundingStreamId)
        {
            SqlQuerySpec sqlQuerySpec = new SqlQuerySpec
            {
                QueryText  = @"SELECT * 
                            FROM    Root r 
                            WHERE   r.content.fundingStreamId = @FundingStreamID 
                                    AND r.documentType = @DocumentType
                                    AND r.deleted = false",
                Parameters = new SqlParameterCollection
                {
                    new SqlParameter("@FundingStreamID", fundingStreamId),
                    new SqlParameter("@DocumentType", nameof(FundingStreamPermission))
                }
            };

            return(await _cosmosRepository.QuerySql <FundingStreamPermission>(sqlQuerySpec, enableCrossPartitionQuery : true));
        }