Esempio n. 1
0
        private static void InitializeRegistryConfig(IConfiguration config, RpcConfig instance)
        {
            var registryNode = config.GetSection("registry");

            if (registryNode == null || !registryNode.GetChildren().Any())
            {
                return;
            }

            try
            {
                var name    = registryNode["name"];
                var type    = registryNode["type"];
                var address = registryNode["address"];

                if (string.IsNullOrEmpty(type))
                {
                    throw new RpcConfigException("type of RpcLite configuration Registry node " + name + " can't be null or empty");
                }

                var registry = new RegistryConfig
                {
                    Name    = name,
                    Type    = type,
                    Address = address,
                };
                instance.Registry = registry;
            }
            catch (Exception ex)
            {
                throw new ConfigException("Client Configuration Error", ex);
            }
        }
Esempio n. 2
0
        private static void InitializeRegistryConfig(IConfiguration config, RpcConfig instance)
        {
            var registryNode = config.GetSection("registry");
            if (registryNode == null || !registryNode.GetChildren().Any()) return;

            try
            {
                var name = registryNode["name"];
                var type = registryNode["type"];
                var address = registryNode["address"];

                if (string.IsNullOrEmpty(type))
                    throw new RpcConfigException("type of RpcLite configuration Registry node " + name + " can't be null or empty");

                var registry = new RegistryConfig
                {
                    Name = name,
                    Type = type,
                    Address = address,
                };
                instance.Registry = registry;
            }
            catch (Exception ex)
            {
                throw new ConfigException("Client Configuration Error", ex);
            }
        }