I am consuming an API of business objects where I don’t have access to the code. I use these objects directly on my razor views and want to be able to be able to apply my custom displayName attributes after the object(s) have been instantiated.
So, instead of this:
[DisplayName("First Name")]
public string GivenName;
I would like to do:
Profile.GivenName.DisplayName("FirstName");
I understand how create the custom attribute, but am having troubles with making them programmatic.
Once I can do this, I can apply more of my DataAnnotations.
Why not instead derive a class from the business object and use the MetaDataType Attribute?