Example #1
0
        public async Task <IEnumerable <string> > GetDistinctRelationshipSpecificationIdsForDatasetDefinitionId(string datasetDefinitionId)
        {
            SqlQuerySpec sqlQuerySpec = new SqlQuerySpec
            {
                QueryText  = @"SELECT d.content.Specification.id AS specificationId
                            FROM    datasets d
                            WHERE   d.deleted = false 
                                    AND d.documentType = ""DefinitionSpecificationRelationship"" 
                                    AND d.content.DatasetDefinition.id = @DatasetDefinitionId",
                Parameters = new SqlParameterCollection
                {
                    new SqlParameter("@DatasetDefinitionID", datasetDefinitionId)
                }
            };

            HashSet <string> specificationIds = new HashSet <string>();

            IEnumerable <dynamic> results = await _cosmosRepository.QueryDynamic(sqlQuerySpec, true, 1000);

            foreach (dynamic result in results)
            {
                specificationIds.Add(result.specificationId);
            }

            return(specificationIds);
        }