MvcServiceCollectionExtensions.AddControllersWithViews メソッド

定義

オーバーロード

AddControllersWithViews(IServiceCollection)

指定した にコントローラーのサービスを追加します IServiceCollection。 このメソッドは、ページに使用されるサービスを登録しません。

AddControllersWithViews(IServiceCollection, Action<MvcOptions>)

指定した にコントローラーのサービスを追加します IServiceCollection。 このメソッドは、ページに使用されるサービスを登録しません。

AddControllersWithViews(IServiceCollection)

指定した にコントローラーのサービスを追加します IServiceCollection。 このメソッドは、ページに使用されるサービスを登録しません。

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

パラメーター

services
IServiceCollection

サービスを追加する先の IServiceCollection

戻り値

IMvcBuilder MVC サービスをさらに構成するために使用できる 。

注釈

このメソッドは、ビューを含むコントローラーで一般的に使用される機能の MVC サービスを構成します。 これにより、、AddApiExplorer(IMvcCoreBuilder)AddFormatterMappings(IMvcCoreBuilder)AddCors(IMvcCoreBuilder)AddViews(IMvcCoreBuilder)AddCacheTagHelper(IMvcCoreBuilder)AddAuthorization(IMvcCoreBuilder)AddDataAnnotations(IMvcCoreBuilder)AddMvcCore(IServiceCollection)効果が組み合わされます。AddRazorViewEngine(IMvcCoreBuilder)

ページのサービスを追加するには、 を呼び出します AddRazorPages(IServiceCollection)

適用対象

AddControllersWithViews(IServiceCollection, Action<MvcOptions>)

指定した にコントローラーのサービスを追加します IServiceCollection。 このメソッドは、ページに使用されるサービスを登録しません。

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

パラメーター

services
IServiceCollection

サービスを追加する先の IServiceCollection

configure
Action<MvcOptions>

指定した MvcOptions を構成する Action<T>

戻り値

IMvcBuilder MVC サービスをさらに構成するために使用できる 。

注釈

このメソッドは、ビューを含むコントローラーで一般的に使用される機能の MVC サービスを構成します。 これにより、、AddApiExplorer(IMvcCoreBuilder)AddFormatterMappings(IMvcCoreBuilder)AddCors(IMvcCoreBuilder)AddViews(IMvcCoreBuilder)AddCacheTagHelper(IMvcCoreBuilder)AddAuthorization(IMvcCoreBuilder)AddDataAnnotations(IMvcCoreBuilder)AddMvcCore(IServiceCollection)効果が組み合わされます。AddRazorViewEngine(IMvcCoreBuilder)

ページのサービスを追加するには、 を呼び出します AddRazorPages(IServiceCollection)

適用対象