Remove dynamic from page endpoints
This commit is contained in:
parent
6f305373ca
commit
7021df89e4
|
|
@ -107,10 +107,6 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
|
||||||
descriptor.RouteValues.Add("page", model.ViewEnginePath);
|
descriptor.RouteValues.Add("page", model.ViewEnginePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark all pages as a "dynamic endpoint" - this is how we deal with the compilation of pages
|
|
||||||
// in endpoint routing.
|
|
||||||
descriptor.EndpointMetadata.Add(new DynamicEndpointMetadata());
|
|
||||||
|
|
||||||
actions.Add(descriptor);
|
actions.Add(descriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -143,10 +139,5 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
|
||||||
// Combine transformed page route with template
|
// Combine transformed page route with template
|
||||||
return AttributeRouteModel.CombineTemplates(transformedPageRoute, pageRouteMetadata.RouteTemplate);
|
return AttributeRouteModel.CombineTemplates(transformedPageRoute, pageRouteMetadata.RouteTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DynamicEndpointMetadata : IDynamicEndpointMetadata
|
|
||||||
{
|
|
||||||
public bool IsDynamic => true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -33,12 +33,11 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
|
||||||
throw new ArgumentNullException(nameof(endpoints));
|
throw new ArgumentNullException(nameof(endpoints));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ContainsDynamicEndpoints(endpoints))
|
// We don't mark Pages as dynamic endpoints because that causes all matcher policies
|
||||||
{
|
// to run in *slow mode*. Instead we produce the same metadata for things that would affect matcher
|
||||||
// Pages are always dynamic endpoints.
|
// policies on both endpoints (uncompiled and compiled).
|
||||||
return false;
|
//
|
||||||
}
|
// This means that something like putting [Consumes] on a page wouldn't work. We've never said that it would.
|
||||||
|
|
||||||
for (var i = 0; i < endpoints.Count; i++)
|
for (var i = 0; i < endpoints.Count; i++)
|
||||||
{
|
{
|
||||||
var page = endpoints[i].Metadata.GetMetadata<PageActionDescriptor>();
|
var page = endpoints[i].Metadata.GetMetadata<PageActionDescriptor>();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue