Say you have a property in a model that looks like this:
[DataType(DataType.DateTime)]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
public DateTime CreationDate { get; set; }
Could you do something like this:
[ComboAttribute] // Does the same thing as the two attributes above
public DateTime CreationDate { get; set; }
I'm exploring ways to ensure all my DateTime
properties have the same set of 4 to 5 attributes. If I have to add or change an attribute, currently I have to use Ctrl + F
and make sure I get every instance, which is just asking for trouble.
Is this possible? Is there a better way to get the error-proofing I'm looking for?