MvcServiceCollectionExtensions.AddRazorPages Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
AddRazorPages(IServiceCollection) |
Adds services for pages to the specified IServiceCollection. |
AddRazorPages(IServiceCollection, Action<RazorPagesOptions>) |
Adds services for pages to the specified IServiceCollection. |
AddRazorPages(IServiceCollection)
Adds services for pages to the specified IServiceCollection.
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddRazorPages (this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
static member AddRazorPages : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IMvcBuilder
<Extension()>
Public Function AddRazorPages (services As IServiceCollection) As IMvcBuilder
Parameters
- services
- IServiceCollection
The IServiceCollection to add services to.
Returns
An IMvcBuilder that can be used to further configure the MVC services.
Remarks
This method configures the MVC services for the commonly used features for pages. This combines the effects of AddMvcCore(IServiceCollection), AddAuthorization(IMvcCoreBuilder), AddDataAnnotations(IMvcCoreBuilder), AddCacheTagHelper(IMvcCoreBuilder), and AddRazorPages(IMvcCoreBuilder).
To add services for controllers for APIs call AddControllers(IServiceCollection).
To add services for controllers with views call AddControllersWithViews(IServiceCollection).
Applies to
AddRazorPages(IServiceCollection, Action<RazorPagesOptions>)
Adds services for pages to the specified IServiceCollection.
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddRazorPages (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.AspNetCore.Mvc.RazorPages.RazorPagesOptions> configure);
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddRazorPages (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.AspNetCore.Mvc.RazorPages.RazorPagesOptions>? configure);
static member AddRazorPages : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<Microsoft.AspNetCore.Mvc.RazorPages.RazorPagesOptions> -> Microsoft.Extensions.DependencyInjection.IMvcBuilder
<Extension()>
Public Function AddRazorPages (services As IServiceCollection, configure As Action(Of RazorPagesOptions)) As IMvcBuilder
Parameters
- services
- IServiceCollection
The IServiceCollection to add services to.
- configure
- Action<RazorPagesOptions>
An Action<T> to configure the provided MvcOptions.
Returns
An IMvcBuilder that can be used to further configure the MVC services.
Remarks
This method configures the MVC services for the commonly used features for pages. This combines the effects of AddMvcCore(IServiceCollection), AddAuthorization(IMvcCoreBuilder), AddDataAnnotations(IMvcCoreBuilder), AddCacheTagHelper(IMvcCoreBuilder), and AddRazorPages(IMvcCoreBuilder).
To add services for controllers for APIs call AddControllers(IServiceCollection).
To add services for controllers with views call AddControllersWithViews(IServiceCollection).