-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Decouple HtmlHelper.GetValidationAttributes from UnobtrusiveValidationAttributesGenerator.GetValidationAttributes #659
Comments
@roryprimrose the general HTML helper extensibility point is the overall For this particular coupling, I'd normally recommend overriding |
@DamianEdwards I think you were toying with some ideas around validation extensibility - were you? |
It would certainly help. Presumably most of that method is still valid however. The only line that would require overriding is
|
@DamianEdwards / @dougbu - Could you get together and come up with an update for this design. |
👌 |
Will generalize this ask a little bit and make a couple of other corrections to the |
Small update related to the |
Thanks, feel free to fix it for me :) |
- 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
- 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
- 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
- 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
Closed with commit 40eb05f |
MVC should not be tightly coupled to Microsoft's implementation of unobtrusive validation. For example, I want to use bootstrapValidator because it is a much better validation framework for working with bootstrap. As it stands, HtmlHelper is tightly coupled to UnobtrusiveValidationAttributesGenerator such that a different implementation cannot be used. This locks everyone into using unobtrusive validation rather than allowing support for custom validation attribute rendering on form fields.
The text was updated successfully, but these errors were encountered: