This repository was archived by the owner on Dec 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Improve IHtmlHelper
, HtmlHelper
, et cetera public API; correct inconsistencies
#874
Comments
dougbu
added a commit
that referenced
this issue
Jul 31, 2014
- address all of #659 and a bit of #874 (avoid `public virtual` methods in `HtmlHelper`) - make `MetadataProvider` and `GetClientValidationRules()` `public` and therefore available to extension methods - remove unused `GetValidationAttributes()` overload - make remaining `GetValidationAttributes()` overload (and not `GetClientValidationRules()`) `virtual`, allowing derived classes to change the attributes without overriding all callers - reverse `GetValidationAttributes()` and `GetClientValidationRules()` parameter order to match precedence - add `GenerateName()` and `GenerateValidationSummary()` to make `protected virtual` method names consistent - `Name()`, `ValidationSummary()` and `TextArea()` are no longer `virtual` because `protected virtual Generate*()` methods exist for all - move `GenerateDisplay()` to a more obvious location in the file
dougbu
added a commit
that referenced
this issue
Jul 31, 2014
- address all of #659 and a bit of #874 (avoid `public virtual` methods in `HtmlHelper`) - make `MetadataProvider` and `GetClientValidationRules()` `public` and therefore available to extension methods - remove unused `GetValidationAttributes()` overload - make remaining `GetValidationAttributes()` overload (and not `GetClientValidationRules()`) `virtual`, allowing derived classes to change the attributes without overriding all callers - reverse `GetValidationAttributes()` and `GetClientValidationRules()` parameter order to match precedence - add `GenerateName()` and `GenerateValidationSummary()` to make `protected virtual` method names consistent - `Name()`, `ValidationSummary()` and `TextArea()` are no longer `virtual` because `protected virtual Generate*()` methods exist for all - move `GenerateDisplay()` to a more obvious location in the file
dougbu
added a commit
that referenced
this issue
Jul 31, 2014
- address all of #659 and a bit of #874 (avoid `public virtual` methods in `HtmlHelper`) - make `MetadataProvider` and `GetClientValidationRules()` `public` and therefore available to extension methods - remove unused `GetValidationAttributes()` overload - make remaining `GetValidationAttributes()` overload (and not `GetClientValidationRules()`) `virtual`, allowing derived classes to change the attributes without overriding all callers - reverse `GetValidationAttributes()` and `GetClientValidationRules()` parameter order to match precedence - add `GenerateName()` and `GenerateValidationSummary()` to make `protected virtual` method names consistent - `Name()`, `ValidationSummary()` and `TextArea()` are no longer `virtual` because `protected virtual Generate*()` methods exist for all
dougbu
added a commit
that referenced
this issue
Jul 31, 2014
- address all of #659 and a bit of #874 (avoid `public virtual` methods in `HtmlHelper`) - make `MetadataProvider` and `GetClientValidationRules()` `public` and therefore available to extension methods - remove unused `GetValidationAttributes()` overload - make remaining `GetValidationAttributes()` overload (and not `GetClientValidationRules()`) `virtual`, allowing derived classes to change the attributes without overriding all callers - reverse `GetValidationAttributes()` and `GetClientValidationRules()` parameter order to match precedence - add `GenerateName()` and `GenerateValidationSummary()` to make `protected virtual` method names consistent - `Name()`, `ValidationSummary()` and `TextArea()` are no longer `virtual` because `protected virtual Generate*()` methods exist for all
dougbu
added a commit
that referenced
this issue
Aug 4, 2014
- see line 2 of #874 - focus on `TextBox[For]()` and `ValidationSummary()` related fixes included here: - `TextArea[For]()` documentation incorrectly indicated their `htmlAttributes` parameters were dictionaries - handle `htmlAttributes` parameters more consistently; create a dictionary only when necessary
dougbu
added a commit
that referenced
this issue
Aug 4, 2014
- #874 lines 3, 4, and 6 - correct `Value()` to treat a `null` expression name the same as `string.Empty` - add missing `[NotNull]` attributes in `EditorExtensions` and for `GenerateIdFromName()` - consistently pass `null` for default expression names to the helpers - for example, from extension methods - add test cases using `null` for expression name nits: - correct summary XML comment for `HtmlHelper` class - use named parameters and prefer interface (not extension) methods in changed calls
dougbu
added a commit
that referenced
this issue
Aug 5, 2014
- #874 lines 3, 4, and 6 - correct `Value()` to treat a `null` expression name the same as `string.Empty` - add missing `[NotNull]` attributes in `EditorExtensions` and for `GenerateIdFromName()` - consistently pass `null` for default expression names to the helpers - for example, from extension methods - add test cases using `null` for expression name nits: - correct summary XML comment for `HtmlHelper` class - use named parameters and prefer interface (not extension) methods in changed calls - use `string.Empty` instead of `""` in a few tests
dougbu
added a commit
that referenced
this issue
Aug 5, 2014
- #874 lines 3, 4, and 6 - correct `Value()` to treat a `null` expression name the same as `string.Empty` - add missing `[NotNull]` attributes in `EditorExtensions` and for `GenerateIdFromName()` - consistently pass `null` for default expression names to the helpers - for example, from extension methods - add test cases using `null` for expression name nits: - correct summary XML comment for `HtmlHelper` class - use named parameters and prefer interface (not extension) methods in changed calls - use `string.Empty` instead of `""` in a few tests
dougbu
added a commit
that referenced
this issue
Aug 5, 2014
- #874 line 5 - `EditorExtensions` -> `HtmlHelperEditorExtensions` - `SelectExtensions` -> `HtmlHelperSelectExtensions`
dougbu
added a commit
that referenced
this issue
Aug 6, 2014
- #874 lines 3, 4, and 6 - correct `Value()` to treat a `null` expression name the same as `string.Empty` - add missing `[NotNull]` attributes in `EditorExtensions` and for `GenerateIdFromName()` - consistently pass `null` for default expression names to the helpers - for example, from extension methods - add test cases using `null` for expression name nits: - correct summary XML comment for `HtmlHelper` class - use named parameters and prefer interface (not extension) methods in changed calls - use `string.Empty` instead of `""` in a few tests
dougbu
added a commit
that referenced
this issue
Aug 6, 2014
- #874 line 5 - `EditorExtensions` -> `HtmlHelperEditorExtensions` - `SelectExtensions` -> `HtmlHelperSelectExtensions`
Fixed in PRs listed above and merged in the following commits (newest on top). Unfortunately a few of the commits mention #847 instead of this bug 😦 |
IHtmlHelper
, HtmlHelper
, et ceteraIHtmlHelper
, HtmlHelper
, et cetera public API; correct inconsistencies
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This bug is about removing inconsistencies created as we ported HTML helpers to MVC 6. As we evolved a few decisions across the multiple commits, we haven't fixed up the earlier work to match.
IHtmlHelper
andIHtmlHelper<TModel>
to corresponding extension methods.IDictionary<string, object>
parameter e,g,IHtmlHelper.TextBox()
andIHtmlHelper.ValidationSummary()
. We decided to stick with just theobject
parameters.[NotNull]
forExpression<Func<TModel, TProperty>> expression
parameter inHtmlHelper.ValueFor()
and throughoutEditorExtensions
.[NotNull]
forthis IHtmlHelper html
parameters inEditorExtensions
.EditorExtensions
andSelectExtensions
.null
expression names everywhere e.g.HtmlHelper.Value()
. Distinct handling ofnull
and empty parameters in some helpers (but not others) has no value.html.LabelForModel()
,html.TextArea()
,html.TextBox()
, andhtml.ValueForModel()
overloads. Our code should reference these extension methods only in tests. (Part of the background here is our default parameter values are now consistentlynull
, making "provide default in one place" much less important.)ViewContext
tohtml.ValidationMessage()
andhtml.ValidationSummary()
.DefaultEditorTemplates
tohtml.DropDownList()
,html.Label()
, andhtml.TextBox()
.public virtual
methods inHtmlHelper
(ignoringHtmlHelper.Contextualize()
) e.g.HtmlHelper.Name()
,HtmlHelper.ValidationSummary()
andHtmlHelper.TextArea()
.public
methods that are extensibility points should have a correspondingprotected virtual
method.public
methods before others.HtmlHelper
is getting fairly large.The text was updated successfully, but these errors were encountered: