Esempio n. 1
0
        public static ICobMvc AddConsul(this ICobMvc web, Action <ConsulClientConfiguration> option)
        {
            web.ConfigureServices(services =>
            {
                services.AddSingleton <IServiceRegistration, ConsulServiceRegistration>(p => new ConsulServiceRegistration(option));
                //services.AddSingleton<ICobConfiguration, ConsulConfiguration>();
            });

            return(web);
        }
Esempio n. 2
0
        /// <summary>
        /// 添加WebSockets支持
        /// </summary>
        /// <param name="web"></param>
        /// <returns></returns>
        public static ICobMvc AddCobWebSockets(this ICobMvc web)
        {
            web.ConfigureServices(services => {
                services.AddSingleton <ICobRequest, WebSocketCobRequest>();
                services.AddSingleton <ServerWebSocketPool>();
                //services.AddSingleton<ClientWebSocketPool>();
                services.AddSingleton <ClientWebSocketPoolFactory>();
            });

            return(web);
        }