public string GetBlobFolderPath(string datasetName) { Dataset dataset = Datasets.Single(x => x.Name == datasetName); AzureBlobDataset outputProps = (AzureBlobDataset)dataset.Properties.TypeProperties; return(outputProps.FolderPath); }
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); }
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); }
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); } }