MvcCoreServiceCollectionExtensions.AddMvcCore 方法

定義

多載

AddMvcCore(IServiceCollection)

將基本 MVC 服務新增至指定的 IServiceCollection 。 其他服務,包括 MVC 對授權、格式器及驗證的支援,都必須使用 IMvcCoreBuilder 從此方法傳回的 個別新增。

AddMvcCore(IServiceCollection, Action<MvcOptions>)

將基本 MVC 服務新增至指定的 IServiceCollection 。 其他服務,包括 MVC 對授權、格式器及驗證的支援,都必須使用 IMvcCoreBuilder 從此方法傳回的 個別新增。

AddMvcCore(IServiceCollection)

將基本 MVC 服務新增至指定的 IServiceCollection 。 其他服務,包括 MVC 對授權、格式器及驗證的支援,都必須使用 IMvcCoreBuilder 從此方法傳回的 個別新增。

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 。 其他服務,包括 MVC 對授權、格式器及驗證的支援,都必須使用 IMvcCoreBuilder 從此方法傳回的 個別新增。

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 的其他組態。

適用於