-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Allow "page" route parameter to be used in Mvc controllers #6704
Conversation
Update FSharp.Core and FSharp.NET.Sdk to latest (#6538)
Ensure IPageApplicationModelProviders are invoked in the sequence of …
Rel/2.0.0
Add empty baselines to suppress api check
Update Roslyn to 2.3.1 (#6571)
Rel/2.0.0
Add global filters with the right scope
Remove the meta refresh tag from the layout page. Add a new line at the end of Home/Index.cshtml
Refactor CORS support out of MVC Core
@@ -10,7 +10,7 @@ public class PageViewLocationExpander : IViewLocationExpander | |||
{ | |||
public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations) | |||
{ | |||
if (string.IsNullOrEmpty(context.PageName)) | |||
if (!(context.ActionContext.ActionDescriptor is PageActionDescriptor) || string.IsNullOrEmpty(context.PageName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider inverting this if to be more readable
@@ -376,5 +376,31 @@ public static IEnumerable<object[]> HtmlHelperLinkGenerationData | |||
// Assert | |||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); | |||
} | |||
|
|||
[Fact] | |||
public async Task UsingPageRouteParameterInConventionRouteWorks() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conventional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix it
Do these places need to change as well? If these already do the right thing, they probably need some comments anyway explaining the subtleties. |
They don't as yet. If we do fix it in the View Engine, would we do the same thing for the inverse case, i.e. not read |
Maybe.... |
The layering makes it tricky to determine if you're working with a |
I would look at |
🆙 📅 |
@@ -240,7 +240,13 @@ private ViewLocationCacheResult LocatePageFromPath(string executingFilePath, str | |||
{ | |||
var controllerName = GetNormalizedRouteValue(actionContext, ControllerKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leave this alone for 2.0.1?
if (actionContext.ActionDescriptor.RouteValues.ContainsKey(PageKey)) | ||
{ | ||
// Only calculate the Razor Page name if "page" is registered in RouteValues. | ||
razorPageName = GetNormalizedRouteValue(actionContext, PageKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally I'd like to change how GetNormalizedRouteValue
works to verify it returns a value only if it's present in RouteValues
but that would be too wide a change for 2.0.1. We could consider it for 2.1.0 though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
Fixes #6660