- #3122 and #3123 (5 of 5)
- avoid concatenating values and wrapping them in an `HtmlString`
- switch from `string.Format()` to `AppendHtml()` in `LinkTagHelper`
- simplify `RazorPage` and `TagHelperContentExtensions` e.g. don't use a `TagHelperContentWrapperTextWriter`
- add some special cases in `UrlResolutionTagHelper`
- add `TagBuilder` and `StringHtmlContent` special cases to avoid `StringWriter` use when value is an `HtmlString`
- move `HtmlTextWriter` optimizations a bit lower and add missing checks for that type
nits:
- correct comments that incorrectly mention `HtmlString`s
- update comments in `JavaScriptStringArrayEncoder`
This change removes the IActionContextAccessor as a dependency of
UrlHelper, and shifts UrlHelper to use a factory pattern. Consumers of
IUrlHelper should create an instance using the factory when needed.
This is the last part of MVC that has a dependency on IActionContext
accessor. As part of this change we no longer register it by default, and
treat it as an optional component.
- Removed `WriteTagHelperAsync` methods from `RazorPage`.
- Moved `WriteTagHelperAsync` tests into Razor since `TagHelperOutput` is now an `IHtmlContent`.
- Updated code generation test files.
aspnet/Razor#358
- `true` has the opposite meaning now but most changes are due to new parameters names in `IViewEngine`
- use name names in `Microsoft.AspNet.Mvc.ViewFound` and not found events
- remove `IRazorPage.IsPartial` and `RazorView.IsPartial`
- remove `IsPartial` properties from `Microsoft.AspNet.Mvc.Razor.BeginInstrumentationContext` and end events
- add parameter checks to `RazorView` constructor; instances are not retrieved from DI
nits:
- remove unused `cacheKey` parameter from `RazorViewEngine.CreateCacheResult()`
- correct duplicate test names in `RazorPageTest`
- also `...OnPageExecutionListenerContext` -> `...OnPageExecutionContext`
- `IRazorViewEngine.MakePathAbsolute()` -> `GetAbsolutePath()`
- set `IsPartial` on all `IRazorPage` instances
- improve consistency of methods in `HtmlHelperPartialExtensions`
- a couple unnecessarily passed `htmlHelper.ViewData`
- add missing tests of these extension methods
- restore parameter checks in `CompositeViewEngine`
- reduce `List<string>` and remove enumerator allocations in `CompositeViewEngine`
nits:
- correct a few comments
- use `<seealso/>`
- do not blindly use `FindPage()` / `FindView()` result in `Exception.Message` or returned results
- failure scenarios involve new `Any()` calls but rarely additional `List<string>()` allocations
- change `ViewEngine_ViewNotFound` resource to be consistent with similar errors
- remove trailing period at end of searched locations list
nit: remove remaining `null` checks of `SearchedLocations` in not found cases; never `null` then
- #3307
- relative paths are now supported in `View()` calls from components and view components,
`Html.PartialAsync()` and similar calls, and `RazorPage.Layout` settings.
- support absolute paths, relative paths, and view location lookups consistently / everywhere
- support view paths in `TemplateRenderer` e.g. passing an absolute path to `Html.EditorFor()`
- take a big swing at the `IRazorViewEngine` and `IViewEngine` interfaces
- split lookups (view names) from navigation (view paths)
- remove `Partial` separation; use parameters to set `IsPartial` properties
- correct `ViewContext` copy constructor and add unit test
- extend unit tests to cover relative paths
- fix existing tests to handle newly-required extension in an absolute path
- add functional test that chains relative paths
nits:
- remove some YOLO line wrapping
- `""` -> `string.Empty`
- wrong fix especially now that test encoders work as expected
- touch up `HtmlHelperTest` and `RazorViewTest` since test encoders are now consistent
- remove references to old `Microsoft.Extensions.WebEncoders.Testing` package
This reverts commit a9d5876cd9.
- but leave `FormTagHelperTest` and `ValidationMessageTagHelperTest` cleanup alone
nit: use `string.Empty` in `HtmlHelperLinkGenerationTest`
- Changed all `GetChildContentAsync` calls to come from `TagHelperOutput` instead of `TagHelperContext`.
- Updated `ReaderAtEndOfFormTagHelper` to properly detect changes inside of a `Form`s body by calling the `Init` method.
- Add test to `RenderAtEndOfFormTagHelperTest`.
aspnet/Razor#571
This change rewrites simple and safe Expression<Func<T, U>> expressions
into accesses to readonly fields. This allows us to cache the actual
expression and avoid repeatedly allocating and compiling it.
The rewrite is limited to cases where we know that the expression doesn't
capture, and where we support that kind of expression for evaluating
viewdata. In practice this means 'indentity' and property accessors are
allowed.
Abstractions - Core MVC extensibility
Controllers - MVC implementations of .Abstractions and supporting
contracts
Infrastructure - General purpose support APIs. Metadata APIs that don't
fit clearly with a feature or with .Abstraction