- copy over from legacy MVC
- fixup namespaces, remove copyright notices, ...
- temporarily remove `RouteBeginForm() overloads
- move main components to `HtmlHelper` and declare in `IHtmlHelper<T>`
- change `UrlHelper` to avoid treating an existing dictionary as an object
- add `HtmlHelper.Createform()` factory
- use in MVC sample; move BeginForm / TextBox samples to a new row
Showcased a lot of the core pieces of DisplayFor in the sample. Some pieces are still missing such as DataType handling. The infrastructure is there to handle it in the TemplateRenderer but the model metadata providers do not construct the metadata with the data types.
Showcased a lot of the core pieces of DisplayFor in the sample. Some pieces are still missing such as DataType handling. The infrastructure is there to handle it in the TemplateRenderer but the model metadata providers do not construct the metadata with the data types.
Showcased a lot of the core pieces of Display in the sample. Some pieces are still missing such as DataType handling. The infrastructure is there to handle it in the TemplateRenderer but the model metadata providers do not construct the metadata with the data types.
Initial draft for DefineSection \ RenderSection. This change is based on
changes to the Razor parser to enable Razor to generate HelperResults for
section instead of void delegates.
- remove a duplicate using of `System.Collections.Generic`
- FYI `k build` command does not detect this problem
- nit: also cleanup long lines and align wrapped parameters
- HtmlHelper service now needs an `IModelMetadataProvider` instance
- make `GetInputTypeString()` private
- use `TextBox()` and `TextBoxFor()` in MVC sample
- throw if `ExpressionMetadataProvider.FromLambdaExpression()` returns `null`
Copy from:
- some `static` `ModelMetadata` methods -> `ExpressionMetadataProvider`
- `TryGetValueDelegate` -> `TryGetValueDelegate`
- `TypeHelpers.CreateTryGetValueDelegate()`, related bits -> `TryGetValueProvider`
- `ViewDataDictionary.ViewDataEvaluator` inner class -> `ViewDataEvaluator`
- `ViewDataInfo` -> `ViewDataInfo`
- `ViewDataDictionary.Eval()`, related bits -> add to `ViewDataDictionary`
Change to fit in new world:
- usual stuff: `var`, `[NotNull]`, String -> string, namespaces, etc.
- PropertyDescriptor -> PropertyInfo
- update Reflection use
- no `IModelMetadata.Container` property
- improve a couple of variable and parameter names
- make `ViewDataInfo` immutable
- make `ViewDataDictionary.FormatValueInternal` `public` and -> `FormatValue`
- remove `[SuppressMessage]` attributes
- correct `ArgumentNullOrEmpty` and pass parameter name to
`ArgumentException` constructor
- remove `[SuppressMessage]` attributes
- `AnonymousObjectToHtmlAttributes` should return an `IDictionary`
- `var`
- remove straggling copyright notices
- wrap long lines (did not reword any comments)
- align a few parameters
- `Name()` is a `virtual` instance method to allow useful derivation
- `NameFor()` is an instance method to avoid adding `GetExpressionName()`
to the public surface; either method could be `virtual`
- `NameForModel()` is an extension method because it's not usefully overridden
- use `Name*()` in sample
- usual stuff, especially use of `var` and `[NotNull]`
- remove references to `ExpressionFingerprintChain` and so on to minimize
classes we bring over now (and remove one cache)
- copy over missing resource
- rework checks in `IsSingleArgumentIndexer()`
There are several portions of model validation that attempt to avoid
revalidating if a field has been validated. However the behavior of
ModelStateDictionary makes it difficult to distinguish between an
unvalidated field and a field without validation errors. This change
resolves this issue by letting the caller distinguish between the two
cases.
- 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.