public ServiceBrokerMessageTransport(LightRailConfiguration config, ServiceBrokerMessageTransportConfiguration transportConfiguration)
 {
     ServiceBrokerMessageType = transportConfiguration.ServiceBrokerMessageType;
     if (string.IsNullOrWhiteSpace(ServiceBrokerMessageType))
     {
         throw new InvalidConfigurationException("ServiceBrokerMessageType cannot be Null or WhiteSpace");
     }
     ServiceBrokerContract = transportConfiguration.ServiceBrokerContract;
     if (string.IsNullOrWhiteSpace(ServiceBrokerContract))
     {
         throw new InvalidConfigurationException("ServiceBrokerContract cannot be Null or WhiteSpace");
     }
     ServiceBrokerQueue = transportConfiguration.ServiceBrokerQueue;
     if (string.IsNullOrWhiteSpace(ServiceBrokerQueue))
     {
         throw new InvalidConfigurationException("ServiceBrokerQueue cannot be Null or WhiteSpace");
     }
     ServiceBrokerService = transportConfiguration.ServiceBrokerService;
     if (string.IsNullOrWhiteSpace(ServiceBrokerService))
     {
         throw new InvalidConfigurationException("ServiceBrokerService cannot be Null or WhiteSpace");
     }
     ConnectionString = transportConfiguration.ServiceBrokerConnectionString;
     if (string.IsNullOrWhiteSpace(ConnectionString) &&
         !string.IsNullOrWhiteSpace(transportConfiguration.ServiceBrokerConnectionStringName) &&
         ConfigurationManager.ConnectionStrings[transportConfiguration.ServiceBrokerConnectionStringName] != null)
     {
         ConnectionString = ConfigurationManager.ConnectionStrings[transportConfiguration.ServiceBrokerConnectionStringName].ConnectionString;
     }
     if (string.IsNullOrWhiteSpace(ConnectionString))
     {
         throw new InvalidConfigurationException("ServiceBrokerConnectionString cannot be Null or WhiteSpace");
     }
     MaxRetries = transportConfiguration.MaxRetries;
     if (MaxRetries < 0)
     {
         MaxRetries = 0;
     }
     MaxConcurrency = transportConfiguration.MaxConcurrency;
     if (MaxConcurrency < 0)
     {
         MaxConcurrency = 0;
     }
     if (MaxConcurrency > 0)
     {
         workerThreadPool = new Semaphore(MaxConcurrency, MaxConcurrency);
     }
     faultManager = new TransportMessageFaultManager(MaxRetries);
 }
 public ServiceBrokerMessageTransport(LightRailConfiguration config, ServiceBrokerMessageTransportConfiguration transportConfiguration)
 {
     ServiceBrokerMessageType = transportConfiguration.ServiceBrokerMessageType;
     if (string.IsNullOrWhiteSpace(ServiceBrokerMessageType))
     {
         throw new InvalidConfigurationException("ServiceBrokerMessageType cannot be Null or WhiteSpace");
     }
     ServiceBrokerContract = transportConfiguration.ServiceBrokerContract;
     if (string.IsNullOrWhiteSpace(ServiceBrokerContract))
     {
         throw new InvalidConfigurationException("ServiceBrokerContract cannot be Null or WhiteSpace");
     }
     ServiceBrokerQueue = transportConfiguration.ServiceBrokerQueue;
     if (string.IsNullOrWhiteSpace(ServiceBrokerQueue))
     {
         throw new InvalidConfigurationException("ServiceBrokerQueue cannot be Null or WhiteSpace");
     }
     ServiceBrokerService = transportConfiguration.ServiceBrokerService;
     if (string.IsNullOrWhiteSpace(ServiceBrokerService))
     {
         throw new InvalidConfigurationException("ServiceBrokerService cannot be Null or WhiteSpace");
     }
     ConnectionString = transportConfiguration.ServiceBrokerConnectionString;
     if (string.IsNullOrWhiteSpace(ConnectionString) &&
         !string.IsNullOrWhiteSpace(transportConfiguration.ServiceBrokerConnectionStringName) &&
         ConfigurationManager.ConnectionStrings[transportConfiguration.ServiceBrokerConnectionStringName] != null)
     {
         ConnectionString = ConfigurationManager.ConnectionStrings[transportConfiguration.ServiceBrokerConnectionStringName].ConnectionString;
     }
     if (string.IsNullOrWhiteSpace(ConnectionString))
     {
         throw new InvalidConfigurationException("ServiceBrokerConnectionString cannot be Null or WhiteSpace");
     }
     MaxRetries = transportConfiguration.MaxRetries;
     if (MaxRetries < 0)
     {
         MaxRetries = 0;
     }
     MaxConcurrency = transportConfiguration.MaxConcurrency;
     if (MaxConcurrency < 0)
     {
         MaxConcurrency = 0;
     }
     if (MaxConcurrency > 0)
     {
         workerThreadPool = new Semaphore(MaxConcurrency, MaxConcurrency);
     }
     faultManager = new TransportMessageFaultManager(MaxRetries);
 }