public override void ExecuteCmdlet() { // ValidationNotNullOrEmpty doesn't handle whitespaces well if (Name != null && string.IsNullOrWhiteSpace(Name)) { throw new PSArgumentNullException("Name"); } DataFactoryFilterOptions filterOptions = new DataFactoryFilterOptions() { Name = Name, ResourceGroupName = ResourceGroupName }; if (Name != null) { List <PSDataFactory> dataFactories = DataFactoryClient.FilterPSDataFactories(filterOptions); if (dataFactories != null && dataFactories.Any()) { WriteObject(dataFactories.First()); } return; } //List data factories until all pages are fetched do { WriteObject(DataFactoryClient.FilterPSDataFactories(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"); } DataFactoryFilterOptions filterOptions = new DataFactoryFilterOptions() { Name = Name, ResourceGroupName = ResourceGroupName }; List <PSDataFactory> dataFactories = DataFactoryClient.FilterPSDataFactories(filterOptions); if (dataFactories != null) { if (dataFactories.Count == 1 && Name != null) { WriteObject(dataFactories[0]); } else { WriteObject(dataFactories, true); } } }