Пример #1
0
        /// <summary>
        /// 添加cobmvc服务发现、调用等相关服务
        /// </summary>
        public static IMvcBuilder AddCobMvc(this IMvcBuilder mvcBuilder, Action <ICobMvc> setup)
        {
            mvcBuilder.Services.AddSingleton(mvcBuilder);

            var container = new DefaultCobMvc(mvcBuilder.Services);

            setup?.Invoke(container);

            container.ApplyConfigure();

            ServicesExtensions.EnsureServerServices(mvcBuilder.Services);

            return(mvcBuilder);
        }
Пример #2
0
        /// <summary>
        /// 添加cobmvc服务发现、调用等相关服务
        /// </summary>
        public static IMvcBuilder AddCobMvc(this IMvcBuilder mvcBuilder, Action <ICobMvc> setup)
        {
            mvcBuilder.Services.AddSingleton(mvcBuilder);

            var container = new DefaultCobMvc(mvcBuilder.Services);

            setup?.Invoke(container);

            container.ApplyConfigure();

            ServicesExtensions.EnsureServerServices(mvcBuilder.Services);

            mvcBuilder.AddMvcOptions(opt => opt.Filters.AddService <CobMvcParametersBinder>());

            return(mvcBuilder);
        }