Пример #1
0
        public string GetBlobFolderPath(string datasetName)
        {
            Dataset          dataset     = Datasets.Single(x => x.Name == datasetName);
            AzureBlobDataset outputProps = (AzureBlobDataset)dataset.Properties.TypeProperties;

            return(outputProps.FolderPath);
        }
Пример #2
0
        public string GetSqlConnectionString(string datasetName)
        {
            Dataset       dataset       = Datasets.Single(x => x.Name == datasetName);
            LinkedService linkedService = LinkedServices.First(x => x.Name == dataset.Properties.LinkedServiceName);

            if (linkedService.Properties.Type != "AzureSqlDatabase")
            {
                throw new Exception($"The linked service is of type '{linkedService.Properties.Type}'. It should be of type 'AzureSqlDatabase'.");
            }

            AzureSqlDatabaseLinkedService sqlLinkedService = linkedService.Properties.TypeProperties as AzureSqlDatabaseLinkedService;

            if (sqlLinkedService == null)
            {
                throw new Exception($"Unable to find data set name '{datasetName}'.");
            }

            string connectionString = sqlLinkedService.ConnectionString;

            if (string.IsNullOrEmpty(connectionString))
            {
                throw new Exception($"Connection string for '{linkedService.Name}' linked service is empty.");
            }

            return(connectionString);
        }
Пример #3
0
        public BlobUtilities GetBlob(string datasetName)
        {
            Dataset                   dataset             = Datasets.Single(x => x.Name == datasetName);
            AzureBlobDataset          outputProps         = (AzureBlobDataset)dataset.Properties.TypeProperties;
            AzureStorageLinkedService outputLinkedService = LinkedServices.First(x => x.Name == dataset.Properties.LinkedServiceName).Properties.TypeProperties as AzureStorageLinkedService;
            string        outputConnectionString          = outputLinkedService?.ConnectionString;
            BlobUtilities outputBlob = new BlobUtilities(Logger, outputConnectionString, outputProps.FolderPath);

            return(outputBlob);
        }
Пример #4
0
 public PBIDataset GetDatasetByName(string name)
 {
     try
     {
         return(Datasets.Single(x => string.Equals(x.Name, name, StringComparison.InvariantCultureIgnoreCase)));
     }
     catch (Exception e)
     {
         //return null;
         throw new KeyNotFoundException(string.Format("No Dataset with name '{0}' could be found in PowerBI!", name), e);
     }
 }