Brad Wilson posted a great blog series on ASP.NET MVC's new ModelMetaData: http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-2-modelmetadata.html
In it, he describes how the ModelMetaData class is now exposed in the Views and templated helpers. What I'd like to do is display an asterisk beside a form field label if the field is required, so I thought about using the IsRequired property of ModelMetaData. However, IsRequired by default is true for all non-nullable properties, while it's false for all nullable properties. The problem is, strings are always nullable, so the IsRequired property is always false for strings. Does anyone know how to override the default of how IsRequired is set? Alternatively, I thought about leveraging the RequiredAttribute attribute that I've been decorating my properties with, but the RequiredAttribute doesn't seem to be exposed through the ModelMetaData class. Does anyone know how to get around this problem?
Thanks in advance.