Reading this Brad Wilson blog post, I'm coming across several attributes开发者_高级运维 (e.g., DisplayFormatString
, EditFormatString
, ShortDisplayName
, SimpleDisplayText
) that seem to have no available documentation, and I'm having no luck figuring out what namespace they belong to.
Do these attributes even exist? Have they been replaced by different attributes? What's going on here?
I don't think there are attributes for these fields. That list is a list of properties found on ModelMetadata, and my guess is the default Data Annotations metadata provider doesn't populate those. You can build some custom attributes, and a custom metadata provider without to much fuss or muss. You can also populate that field from procedural code anywhere you have the ViewData instance.
精彩评论