Validate() public method

public Validate ( ) : void
return void
コード例 #1
0
        public IConnectionConfiguration Parse(string connectionString)
        {
            ConnectionString = connectionString;

            try
            {
                connectionConfiguration = new ConnectionConfiguration();

                foreach (var pair in
                         (from property in typeof(ConnectionConfiguration).GetProperties()
                          let match = Regex.Match(connectionString, string.Format("[^\\w]*{0}=(?<{0}>[^;]+)", property.Name), RegexOptions.IgnoreCase)
                                      where match.Success
                                      select new { Property = property, match.Groups[property.Name].Value }))
                {
                    pair.Property.SetValue(connectionConfiguration, TypeDescriptor.GetConverter(pair.Property.PropertyType).ConvertFromString(pair.Value), null);
                }

                if (ContainsKey("host"))
                {
                    connectionConfiguration.ParseHosts(this["host"] as string);
                }

                connectionConfiguration.Validate();
                return(connectionConfiguration);
            }
            catch (Exception parseException)
            {
                throw new Exception(string.Format("Connection String parsing exception {0}", parseException.Message));
            }
        }
コード例 #2
0
        public ConnectionConfiguration Parse(string connectionString)
        {
            ConnectionString = connectionString;

            connectionConfiguration = new ConnectionConfiguration();

            foreach (var pair in
                (from property in typeof(ConnectionConfiguration).GetProperties()
                 let match = Regex.Match(connectionString, string.Format("[^\\w]*{0}=(?<{0}>[^;]+)", property.Name), RegexOptions.IgnoreCase)
                 where match.Success
                 select new
                        {
                            Property = property,
                            match.Groups[property.Name].Value
                        }))
                pair.Property.SetValue(connectionConfiguration, TypeDescriptor.GetConverter(pair.Property.PropertyType).ConvertFromString(pair.Value), null);

            if (ContainsKey("host"))
            {
                connectionConfiguration.ParseHosts(this["host"] as string);
            }

            if (settings.HasSetting("Endpoint.DurableMessages"))
            {
                connectionConfiguration.UsePublisherConfirms = settings.GetOrDefault<bool>("Endpoint.DurableMessages");
            }


            connectionConfiguration.ClientProperties["endpoint_name"] = settings.GetOrDefault<string>("EndpointName");

            connectionConfiguration.Validate();
            return connectionConfiguration;
        }
コード例 #3
0
        public IConnectionConfiguration Parse(string connectionString)
        {
            ConnectionString = connectionString;

            connectionConfiguration = new ConnectionConfiguration();

            foreach (var pair in
                (from property in typeof(ConnectionConfiguration).GetProperties()
                    let match = Regex.Match(connectionString, string.Format("[^\\w]*{0}=(?<{0}>[^;]+)", property.Name), RegexOptions.IgnoreCase)
                    where match.Success
                    select new
                           {
                               Property = property,
                               match.Groups[property.Name].Value
                           }))
                pair.Property.SetValue(connectionConfiguration, TypeDescriptor.GetConverter(pair.Property.PropertyType).ConvertFromString(pair.Value), null);

            if (ContainsKey("host"))
            {
                connectionConfiguration.ParseHosts(this["host"] as string);
            }

            connectionConfiguration.Validate();
            return connectionConfiguration;
        }
コード例 #4
0
        public ConnectionConfiguration Parse(string connectionString)
        {
            ConnectionString = connectionString;

            connectionConfiguration = new ConnectionConfiguration();

            foreach (var pair in
                     (from property in typeof(ConnectionConfiguration).GetProperties()
                      let match = Regex.Match(connectionString, string.Format("[^\\w]*{0}=(?<{0}>[^;]+)", property.Name), RegexOptions.IgnoreCase)
                                  where match.Success
                                  select new
            {
                Property = property,
                match.Groups[property.Name].Value
            }))
            {
                pair.Property.SetValue(connectionConfiguration, TypeDescriptor.GetConverter(pair.Property.PropertyType).ConvertFromString(pair.Value), null);
            }

            if (connectionConfiguration.UseTls && !ContainsKey("port"))
            {
                connectionConfiguration.Port = 5671;
            }

            if (ContainsKey("host"))
            {
                connectionConfiguration.ParseHosts(this["host"] as string);
            }

            if (settings.HasSetting("Endpoint.DurableMessages"))
            {
                connectionConfiguration.UsePublisherConfirms = settings.GetOrDefault <bool>("Endpoint.DurableMessages");
            }


            connectionConfiguration.ClientProperties["endpoint_name"] = settings.GetOrDefault <string>("EndpointName");

            connectionConfiguration.Validate();
            return(connectionConfiguration);
        }