Exemplo n.º 1
0
        public void AddOptions(IConfigurationSection configuration)
        {
            if (!configuration.Exists())
            {
                return;
            }
            foreach (var section in configuration.GetChildren())
            {
                switch (section.Key.ToLower())
                {
                case "threadpool_minthreads":
                    UraganoOptions.SetOption(UraganoOptions.ThreadPool_MinThreads, configuration.GetValue <int>(section.Key));
                    break;

                case "threadpool_completionportthreads":
                    UraganoOptions.SetOption(UraganoOptions.ThreadPool_CompletionPortThreads, configuration.GetValue <int>(section.Key));
                    break;

                case "consul_node_status_refresh_interval":
                    UraganoOptions.SetOption(UraganoOptions.Consul_Node_Status_Refresh_Interval, TimeSpan.FromMilliseconds(configuration.GetValue <int>(section.Key)));
                    break;

                case "server_dotnetty_channel_sobacklog":
                    UraganoOptions.SetOption(UraganoOptions.Server_DotNetty_Channel_SoBacklog, configuration.GetValue <int>(section.Key));
                    break;

                case "dotnetty_connect_timeout":
                    UraganoOptions.SetOption(UraganoOptions.DotNetty_Connect_Timeout, TimeSpan.FromMilliseconds(configuration.GetValue <int>(section.Key)));
                    break;

                case "dotnetty_enable_libuv":
                    UraganoOptions.SetOption(UraganoOptions.DotNetty_Enable_Libuv, configuration.GetValue <bool>(section.Key));
                    break;

                case "dotnetty_event_loop_count":
                    UraganoOptions.SetOption(UraganoOptions.DotNetty_Event_Loop_Count, configuration.GetValue <int>(section.Key));
                    break;

                case "remoting_invoke_cancellationtokensource_timeout":
                    UraganoOptions.SetOption(UraganoOptions.Remoting_Invoke_CancellationTokenSource_Timeout, TimeSpan.FromMilliseconds(configuration.GetValue <int>(section.Key)));
                    break;

                case "output_dynamicproxy_sourcecode":
                    UraganoOptions.SetOption(UraganoOptions.Output_DynamicProxy_SourceCode, configuration.GetValue <bool>(section.Key));
                    break;
                }
            }
        }
Exemplo n.º 2
0
 public void Option <T>(UraganoOption <T> option, T value)
 {
     UraganoOptions.SetOption(option, value);
 }