public static IEnumerable <EndPoint> Publishers(this EndPointConfig config) { if (config.EndPoints == null) { return(new List <EndPoint>().AsEnumerable()); } else { return(from g in config.EndPoints where g.EndPointType == EndPointTypeOptions.Publisher select g); } }
public static void RemoveEndPoint(this EndPointConfig config, string name) { if (config.EndPoints != null) { EndPoint match = config.EndPoints.FirstOrDefault(g => g.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); if (match != null) { config.EndPoints.Remove(match); } } }
public static void AddEndPoint(this EndPointConfig config, EndPoint toAdd) { if (config.EndPoints == null) { config.EndPoints = new List <EndPoint>(); } if (config.EndPoints.Exists(g => g.Name.Equals(toAdd.Name, StringComparison.OrdinalIgnoreCase))) { throw new InvalidOperationException(string.Format("EndPoint: {0} already exists", toAdd.Name)); } config.EndPoints.Add(toAdd); }