So, there are tons of examples of making custom data validators, but what I need is a Data Annotation that will just add an attribute to the final markup. My google-fu must just be weak today. The basic idea would be:
Model.cs
[SomeCustomAttribute]
public int CoolProperty {get;set}
View.cshtml
@Html.EditorFor(q => q.CoolProperty)
Then, the magical Wizardry ensues here:
public class SomeCustomAttribute : SomeAwesomeClassToInheritThatICantFind {
public override void AddAttributes() {
AddAttribute("CustomAttribute");
}
}
And, finally I'd like the markup rendered as:
<input type="text" CustomAttribute>
Obviously it'd be more complicated, but that's the gist of it. I know i can just chuck this in the view, but I'm going to be reusing this particular logic all over the place and it seems like there should be some way to do this. Something similar to the Display attribute.
If there's another approach that I'm missing, I'm all for that as well.