/// <summary> /// Constructor. /// </summary> /// <param name="serviceOptions">Configuration parameters.</param> internal ServiceBusRestProxy(ServiceConfiguration serviceOptions) { Debug.Assert(serviceOptions != null); ServiceConfig = serviceOptions; HttpMessageHandler chain = new HttpErrorHandler( new WrapAuthenticationHandler(serviceOptions)); Channel = new HttpClient(chain); }
/// <summary> /// Constructor. /// </summary> /// <param name="serviceConfig">Configuration of the service.</param> internal WrapAuthenticationHandler(ServiceConfiguration serviceConfig) { ServiceConfig = serviceConfig; Tokens = new Dictionary<string, WrapToken>(StringComparer.OrdinalIgnoreCase); SyncObject = new object(); HttpMessageHandler handlers = new HttpErrorHandler( new HttpClientHandler()); Channel = new HttpClient(handlers); }
/// <summary> /// Creates a service bus servive using given settings. /// </summary> /// <param name="serviceNamespace">Service namespace</param> /// <param name="userName">User name</param> /// <param name="password">Password</param> /// <returns>A service bus service with the given parameters</returns> public static IServiceBusService Create(string serviceNamespace, string userName, string password) { if (serviceNamespace == null) { throw new ArgumentNullException("serviceNamespace"); } if (userName == null) { throw new ArgumentNullException("userName"); } if (password == null) { throw new ArgumentNullException("password"); } ServiceConfiguration serviceOptions = new ServiceConfiguration(serviceNamespace, userName, password); return new ServiceBusRestProxy(serviceOptions); }