/// <summary> /// Adds the <see cref="ISoapHandler"/> to the <see cref="Handlers"/> collection. /// </summary> /// <param name="handler">The handler to add</param> /// <exception cref="ArgumentNullException"></exception> public void AddHandler(ISoapHandler handler) { if (handler == null) { throw new ArgumentNullException(nameof(handler)); } _handlers.Add(handler); }
/// <summary> /// Adds the given handler to the SOAP client /// </summary> /// <typeparam name="TSoapClient">The SOAP client type</typeparam> /// <param name="client">The client to be used</param> /// <param name="handler">The handler to add</param> /// <returns>The SOAP client after changes</returns> /// <exception cref="ArgumentNullException"></exception> public static TSoapClient WithHandler <TSoapClient>(this TSoapClient client, ISoapHandler handler) where TSoapClient : ISoapClient { if (client == null) { throw new ArgumentNullException(nameof(client)); } if (handler == null) { throw new ArgumentNullException(nameof(handler)); } client.AddHandler(handler); return(client); }