MvcCoreServiceCollectionExtensions.AddMvcCore 方法

定义

重载

AddMvcCore(IServiceCollection)

将最小基本 MVC 服务添加到指定的 IServiceCollection。 必须使用此方法返回的 单独添加 IMvcCoreBuilder 其他服务,包括 MVC 对授权、格式化程序和验证的支持。

AddMvcCore(IServiceCollection, Action<MvcOptions>)

将最小基本 MVC 服务添加到指定的 IServiceCollection。 必须使用此方法返回的 单独添加 IMvcCoreBuilder 其他服务,包括 MVC 对授权、格式化程序和验证的支持。

AddMvcCore(IServiceCollection)

将最小基本 MVC 服务添加到指定的 IServiceCollection。 必须使用此方法返回的 单独添加 IMvcCoreBuilder 其他服务,包括 MVC 对授权、格式化程序和验证的支持。

public static Microsoft.Extensions.DependencyInjection.IMvcCoreBuilder AddMvcCore (this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
static member AddMvcCore : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IMvcCoreBuilder
<Extension()>
Public Function AddMvcCore (services As IServiceCollection) As IMvcCoreBuilder

参数

services
IServiceCollection

要向其中添加服务的 IServiceCollection

返回

IMvcCoreBuilder可用于进一步配置 MVC 服务的 。

注解

配置 AddMvcCore(IServiceCollection) MVC 的方法适用于希望完全控制注册的默认服务集的经验丰富的 MVC 开发人员。 AddMvcCore(IServiceCollection) 将注册路由请求和调用控制器所需的最少服务集。 预计任何应用程序都不会只需调用 AddMvcCore(IServiceCollection)即可满足其要求。 需要使用 进行其他配置 IMvcCoreBuilder

适用于

AddMvcCore(IServiceCollection, Action<MvcOptions>)

将最小基本 MVC 服务添加到指定的 IServiceCollection。 必须使用此方法返回的 单独添加 IMvcCoreBuilder 其他服务,包括 MVC 对授权、格式化程序和验证的支持。

public static Microsoft.Extensions.DependencyInjection.IMvcCoreBuilder AddMvcCore (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.AspNetCore.Mvc.MvcOptions> setupAction);
static member AddMvcCore : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<Microsoft.AspNetCore.Mvc.MvcOptions> -> Microsoft.Extensions.DependencyInjection.IMvcCoreBuilder
<Extension()>
Public Function AddMvcCore (services As IServiceCollection, setupAction As Action(Of MvcOptions)) As IMvcCoreBuilder

参数

services
IServiceCollection

要向其中添加服务的 IServiceCollection

setupAction
Action<MvcOptions>

用于配置所提供的 MvcOptionsAction<T>

返回

IMvcCoreBuilder可用于进一步配置 MVC 服务的 。

注解

配置 AddMvcCore(IServiceCollection) MVC 的方法适用于希望完全控制注册的默认服务集的经验丰富的 MVC 开发人员。 AddMvcCore(IServiceCollection) 将注册路由请求和调用控制器所需的最少服务集。 预计任何应用程序都不会只需调用 AddMvcCore(IServiceCollection)即可满足其要求。 需要使用 进行其他配置 IMvcCoreBuilder

适用于