public override void ExecuteCmdlet() { // ValidationNotNullOrEmpty doesn't handle whitespaces well if (Name != null && string.IsNullOrWhiteSpace(Name)) { throw new PSArgumentNullException("Name"); } if (ParameterSetName == ByFactoryObject) { if (DataFactory == null) { throw new PSArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.DataFactoryArgumentInvalid)); } DataFactoryName = DataFactory.DataFactoryName; ResourceGroupName = DataFactory.ResourceGroupName; } TableFilterOptions filterOptions = new TableFilterOptions() { Name = Name, ResourceGroupName = ResourceGroupName, DataFactoryName = DataFactoryName }; if (Name != null) { List <PSTable> tables = DataFactoryClient.FilterPSTables(filterOptions); if (tables != null && tables.Any()) { WriteObject(tables[0]); } return; } // List tables until all pages are fetched do { WriteObject(DataFactoryClient.FilterPSTables(filterOptions), true); } while (filterOptions.NextLink.IsNextPageLink()); }
public override void ExecuteCmdlet() { // ValidationNotNullOrEmpty doesn't handle whitespaces well if (Name != null && string.IsNullOrWhiteSpace(Name)) { throw new PSArgumentNullException("Name"); } if (ParameterSetName == ByFactoryObject) { if (DataFactory == null) { throw new PSArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.DataFactoryArgumentInvalid)); } DataFactoryName = DataFactory.DataFactoryName; ResourceGroupName = DataFactory.ResourceGroupName; } TableFilterOptions filterOptions = new TableFilterOptions() { Name = Name, ResourceGroupName = ResourceGroupName, DataFactoryName = DataFactoryName }; List <PSTable> tables = DataFactoryClient.FilterPSTables(filterOptions); if (tables != null) { if (tables.Count == 1 && Name != null) { WriteObject(tables[0]); } else { WriteObject(tables, true); } } }