- remove `ViewContext.UnobtrusiveJavaScriptEnabled` property and all references
- avoid `ViewContext.GetFormContextForClientValidation()` calls since
ternary expression is more explicit and we were inconsistent
- improve `ValidationMessage()` comments
- don't treat `ModelState.IsValid` as if it were still nullable
1. Added HttpNotFound() to Controller.
2. Updated HttpStatusCodeResult to expose the StatusCode as a property.
3. Added unit tests for HttpNotFound() and for HttpStatusCodeResult.
4. Updated the MvcSample to add an action that uses HttpNotFound().
5. Brought back HttpNotFoundResult and added unit tests for it.
For pages that can pop back (e.g. Partial pages \ View Components), the
invoking component already creates a new ViewContext. ViewStart, Pages
and Layouts need to share the same Layout. This is required for sharing
ViewData values (such as title).
Fixes#861
- subclasses would not calculate a value because `ModelMetadata` constructor
set this property
- meant presence of a `[Required]` attribute in the model was ignored
- value comes from `Name` property of `[Display]` attribute
- use new property in `@Html.DisplayName()` and `@Html.Label()`; remove associated TODO comments
- this method delegates to a number of `ModelMetadata` properties
- no use cases for overriding; should not be `virtual`
- `ModelMetadata.DisplayName` override using `DisplayAttribute.GetName()` coming in next commit
RazorView was part of the previous commit but was separated to make it
easier to see the diff in RazorPage that was formerly named RazorView
Adding IRazorPage and changes per code review comments
* Introducing RazorPage and RazorPageOfT that represent the Razor
execution aspect of view execution. Moving view execution hierarchy behavior
(Layout, partial views etc) into a separate RazorView type.
* Renaming IVirtualPathViewFactory to IRazorPageFactory,
IRazorViewActivator to IRazorPageActivator
* Renaming VirtualPathViewFactor to FileBasedPageFactory to
correctly reflect what it does.
Fixes#814
This change exludes internal and nested types from being treated as
controllers. This is consistent with MVC5's behavior.
DefaultActionSelectionConventions was primarily tested through running
action selection. I wanted to also test the methods with substantial logic
in this class, so I moved a spate of a classes from private classes inside of the
integration tests to public classes so they could be shared. I also added
tests to fill gaps in DefaultActionSelectionConventions, which is the vast
vast majority of this change.
* Removing Init method and using [Activate] to activate IUrlHelper.
* Moving IViewComponentHelper to default injected properties
* Adding functional tests to verify these properties are injected \
activated
Fixes#789
Move compilation and VirtualPathViewFactory to be singletons
And cache access to files.
The cache time is controlled by MVC options.
The cache is implemented in the ExpiringFileInfoCache.cs
This change allows a user to override a route prefix set using
[Route("...")] on the controller by providing a route template
on the action that starts with "~/" or "/". For example,
[HttpGet("~/...")] or [HttpGet("/...")]
If the user specifies a template in [Route] that starts with "~/"
or "/", we will just strip the prefix from the template and use
the remaining part of the template.
The reason to do this is that there's a reasonable extensibility
scenario where a user can implement a global prefix for routes as
a convention (using IReflectedApplicationModelConvention), and use
~/ to escape that prefix (just like we support with action-level routes).
The await/async patterns adds a state machine that takes time to jit, in this
case the await is not necessary and the code remains simple without adding
continuations.