zoukankan      html  css  js  c++  java
  • FeatureProviders

     /// <summary>
            /// Adds the minimum essential MVC services to the specified <see cref="IServiceCollection" />. Additional services
            /// including MVC's support for authorization, formatters, and validation must be added separately using the
            /// <see cref="IMvcCoreBuilder"/> returned from this method.
            /// </summary>
            /// <param name="services">The <see cref="IServiceCollection" /> to add services to.</param>
            /// <returns>An <see cref="IMvcCoreBuilder"/> that can be used to further configure the MVC services.</returns>
            /// <remarks>
            /// The <see cref="MvcCoreServiceCollectionExtensions.AddMvcCore(IServiceCollection)"/> approach for configuring
            /// MVC is provided for experienced MVC developers who wish to have full control over the set of default services
            /// registered. <see cref="MvcCoreServiceCollectionExtensions.AddMvcCore(IServiceCollection)"/> will register
            /// the minimum set of services necessary to route requests and invoke controllers. It is not expected that any
            /// application will satisfy its requirements with just a call to
            /// <see cref="MvcCoreServiceCollectionExtensions.AddMvcCore(IServiceCollection)"/>. Additional configuration using the
            /// <see cref="IMvcCoreBuilder"/> will be required.
            /// </remarks>
            public static IMvcCoreBuilder AddMvcCore(this IServiceCollection services)
            {
                if (services == null)
                {
                    throw new ArgumentNullException(nameof(services));
                }
    
                var partManager = GetApplicationPartManager(services);
                services.TryAddSingleton(partManager);
    
                ConfigureDefaultFeatureProviders(partManager);
                ConfigureDefaultServices(services);
                AddMvcCoreServices(services);
    
                var builder = new MvcCoreBuilder(services, partManager);
    
                return builder;
            }
    
            private static void ConfigureDefaultFeatureProviders(ApplicationPartManager manager)
            {
                if (!manager.FeatureProviders.OfType<ControllerFeatureProvider>().Any())
                {
                    manager.FeatureProviders.Add(new ControllerFeatureProvider());
                }
            }
  • 相关阅读:
    C. 1D Sokoban 二分,思维
    E. Almost Fault-Tolerant Database 暴力枚举 + 分类讨论 + 思维 Codeforces Round #704 (Div. 2)
    Tkinter(六):Checkbutton 复选按钮
    LeetCode260. 只出现一次的数字 III
    LeetCode297. 二叉树的序列化与反序列化
    LeetCode300. 最长上升子序列
    LeetCode299. 猜数字游戏
    LeetCode295. 数据流的中位数
    你真的知道嵌入式系统的优先级吗?
    学习4412开发板gdb和gdbserver的调试
  • 原文地址:https://www.cnblogs.com/871735097-/p/12121236.html
Copyright © 2011-2022 走看看