MvcServiceCollectionExtensions.AddControllersWithViews Método

Definición

Sobrecargas

AddControllersWithViews(IServiceCollection)

Agrega servicios para controladores al especificado IServiceCollection. Este método no registrará los servicios usados para las páginas.

AddControllersWithViews(IServiceCollection, Action<MvcOptions>)

Agrega servicios para controladores al especificado IServiceCollection. Este método no registrará los servicios usados para las páginas.

AddControllersWithViews(IServiceCollection)

Agrega servicios para controladores al especificado IServiceCollection. Este método no registrará los servicios usados para las páginas.

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

Parámetros

services
IServiceCollection

La interfaz IServiceCollection a la que se van a agregar los servicios.

Devoluciones

que IMvcBuilder se puede usar para configurar aún más los servicios MVC.

Comentarios

Este método configura los servicios MVC para las características usadas habitualmente con controladores con vistas. Esto combina los efectos de AddMvcCore(IServiceCollection), , AddApiExplorer(IMvcCoreBuilder)AddAuthorization(IMvcCoreBuilder), AddCors(IMvcCoreBuilder)AddDataAnnotations(IMvcCoreBuilder), AddFormatterMappings(IMvcCoreBuilder), , AddCacheTagHelper(IMvcCoreBuilder), , AddViews(IMvcCoreBuilder)y AddRazorViewEngine(IMvcCoreBuilder).

Para agregar servicios para las páginas, llame a AddRazorPages(IServiceCollection).

Se aplica a

AddControllersWithViews(IServiceCollection, Action<MvcOptions>)

Agrega servicios para controladores al especificado IServiceCollection. Este método no registrará los servicios usados para las páginas.

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

Parámetros

services
IServiceCollection

La interfaz IServiceCollection a la que se van a agregar los servicios.

configure
Action<MvcOptions>

Action<T> para configurar el objeto MvcOptions proporcionado.

Devoluciones

que IMvcBuilder se puede usar para configurar aún más los servicios MVC.

Comentarios

Este método configura los servicios MVC para las características usadas habitualmente con controladores con vistas. Esto combina los efectos de AddMvcCore(IServiceCollection), , AddApiExplorer(IMvcCoreBuilder)AddAuthorization(IMvcCoreBuilder), AddCors(IMvcCoreBuilder)AddDataAnnotations(IMvcCoreBuilder), AddFormatterMappings(IMvcCoreBuilder), , AddCacheTagHelper(IMvcCoreBuilder), , AddViews(IMvcCoreBuilder)y AddRazorViewEngine(IMvcCoreBuilder).

Para agregar servicios para las páginas, llame a AddRazorPages(IServiceCollection).

Se aplica a