- add `IHtmlHelper<T>` and `ICanHasViewContext`
- adjust `HtmlHelper` and `HtmlHelper<T>` to match
- throw if `ViewContext` accessed prior to `Contextualize` call
- XML comments (from old world) all around
Note
- no current need for an `HtmlHelper` copy constructor or `Clone()` method
- expect recursion code to get another injected `IHtmlHelper<T>` and then
"contextualize" that instance with a new `ViewContext`
- start with `FormContext` and classes it needs from legacy world
- FYI `ModelClientValidationRule` came from Web Pages; the rest from MVC
Cleanup and make files compile in new world
- remove `FormContext.GetJsonValidationMetadata` method; will file an
issue to revive this using Json.NET
- don't store `FormContext` in the `HttpContext`, no longer have child
actions
- do `null` checks in setters, not getters (minor perf improvement)
- fix namespaces and usings
- wrap long lines; use `[NotNull]`; no copyright notice
- use explicit comparers for dictionaries
- add XML comment for odd `ModelClientValidationRule.ValidationType`
property
- Collection -> List
Compared to legacy MVC:
- correct usings and namespace
- remove `GetFullHtmlFieldId` method; depends on `HtmlHelper` method that
can't be static
- String -> string
- remove reference to a legacy bug
- convert internal `VisitedObjects` property to public `AddVisited()` method
Further cleanup
- remove explicit backing fields for remaining properties
- add copy constructor to replace code distributed around legacy MVC
- don't "combine and trim" in `GetFullHtmlFieldName()`
This was causing intellisense failures in VS. It looks like the
commandline is able to accidentally pick up the compatability extensions
from the model binding assembly, but this is not the case in VS.
Changed this code not to rely on compatability extensions.
This doesn't add any new extensibility, and will likely change again in
the future when we add extensibility. For now this is a stopgap to reduce
duplication between JsonResult and JsonViewComponentResult.
We'll create a scoped service provider if the middleware that does it
isn't there.
We resolve all of our stuff from the scoped service provider, allowing
users to plug in any scoped things they want.
Ported UrlHelper to be a scoped service.
- move `DynamicObject` derivation up to new `DynamicViewData` class, fixing [WebFx-169](http://projectk-tc:8080/browse/WEBFX-169)
- avoid direct `_data` lookup in previous `TryGetMember()`, fixing [#118](https://github.com/aspnet/WebFx/issues/118)
- rename ViewData -> ViewDataDictionary
Also
- flesh out `IDictionary<string, object>` implementation in `ViewData`
- provide `ViewData` copy constructor that allows TModel to change
- remove `TryGetIndex()` and `TrySetIndex()` implementations; use `ViewData[]` instead
- restore `ViewContext.ViewBag` from legacy MVC
Modified ModelState to only ever be created on the ActionContext and then plumbed/exposed it on ViewData and Controller. This will enable: ActionFilterContext's will have access to ModelState via its ActionContext member, allow HTMLHelpers to access ModelState via ViewData, and unify the locations of "source" model state. In the old world we used to copy/replace/instantiate new model state all over unnecessarily.
- demonstrate `ModelMetadata` is available in a view
Also
- simplify `View()` overloads in `Controller`, pending #110 decisions
- make `Model` in `RazorView<T>` readonly
This will be necessary for partials, and for Components.
Basically, the view engine uses a dictionary of data to find the top level
view (for an action) - after we do that, we want this context to be
sticky, which means we need to pass it around. This ensures that partials
and components will be resolved under the same paths as the main view.
Currently this 'data' is just the route values - and there is an ongoing
discussing about the right design here. The data that's being passed WILL
change in the future.
and only use RouteValues (or generically just Dictionary<string, object>).
This is temporary and will change once we get Partials (which are currently just dead code)
For now this will unblock ViewComponents
The changes include:
1. Action executor changes required for supporting sync and async operations Taksk and Task
2. Adding test project for MVC core - This contains ActionExecutor Tests.
3. Also adding a resources file for MVC core project
- add missing `[NotNull]` attributes
- remove now-unneeded usings for ...ModelBinding.Internal namespace
Also get ModelBinding test project working under CoreCLR
- create separate k10 and net45 folders under test in VS
- add `[InternalsVisibleTo]` to make `TypeExtensions` visible to test assembly
- correct tests' `CultureInfo` use to compile under CoreCLR
- ifdef out CoreCLR tests depending on Moq, ReadOnly, ...
- remove a couple of tests expecting TypeConverter to work
1. Areas defined by the Area attribute
2. Areas are a routeconstraint on the actiondescriptor
3. Areas find pages through route values
Other changes:
1. Remove Path from ActionDescriptor - It doesn't make sense with this change
2. Add sample Area