Validate() 공개 메소드

public Validate ( ) : void
리턴 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));
            }
        }
        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;
        }
        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);
        }