Place RP convention scenarios in context (#6053)
* Place RP convention scenarios in context * React to feedbackpull/6065/head
parent
1a46d216d9
commit
dd23f94aed
|
@ -36,6 +36,25 @@ Learn how to use page [route and app model provider convention](xref:mvc/control
|
|||
| [Default page app model provider](#replace-the-default-page-app-model-provider) | Replace the default page model provider to change the conventions for handler names. |
|
||||
::: moniker-end
|
||||
|
||||
Razor Pages conventions are added and configured using the [AddRazorPagesOptions](/dotnet/api/microsoft.extensions.dependencyinjection.mvcrazorpagesmvcbuilderextensions.addrazorpagesoptions) extension method to [AddMvc](/dotnet/api/microsoft.extensions.dependencyinjection.mvcservicecollectionextensions.addmvc) on the service collection in the `Startup` class. The following convention examples are explained later in this topic:
|
||||
|
||||
```csharp
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddMvc()
|
||||
.AddRazorPagesOptions(options =>
|
||||
{
|
||||
options.Conventions.Add( ... );
|
||||
options.Conventions.AddFolderRouteModelConvention("/OtherPages", model => { ... });
|
||||
options.Conventions.AddPageRouteModelConvention("/About", model => { ... });
|
||||
options.Conventions.AddPageRoute("/Contact", "TheContactPage/{text?}");
|
||||
options.Conventions.AddFolderApplicationModelConvention("/OtherPages", model => { ... });
|
||||
options.Conventions.AddPageApplicationModelConvention("/About", model => { ... });
|
||||
options.Conventions.ConfigureFilter(model => { ... });
|
||||
options.Conventions.ConfigureFilter( ... );
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
## Model conventions
|
||||
|
||||
|
|
Loading…
Reference in New Issue