title: ASP.NET MVC 2 - Implementing custom Metadata and Validator Providers
body: <p>With the <a href="http://haacked.com/archive/2009/10/01/asp.net-mvc-preview-2-released.aspx" rel="nofollow noreferrer">preview 2 release of ASP.NET MVC 2</a>, we now have base classes to implement our own custom providers for metadata and validation. Specifically, with <a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.modelmetadataprovider(VS.100).aspx" rel="nofollow noreferrer">ModelMetadataProvider</a> and <a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.modelvalidatorprovider(VS.100).aspx" rel="nofollow noreferrer">ModelValidatorProvider</a>.</p>
  
  <p>There isn't a lot of documentation on these yet (just released yesterday as a <strong>preview</strong>, so I'm neither surprised nor disappointed). </p>
  
  <p>Has anyone gotten custom implementations of either of these working? A very simple example (metadata and validator for just "Required") would be great!</p>
  
  <p>Perhaps a lot of people have the same idea, but I'd like to use IronRuby to inject the metadata, and I'm looking for any example to get started.</p>
  
  <p>Thanks!</p>
  
  <p><strong><em>Edit</em></strong>: Sounds like <a href="http://bradwilson.typepad.com/about.html" rel="nofollow noreferrer">Brad Wilson</a> (of <a href="http://www.codeplex.com/xunit" rel="nofollow noreferrer">xUnit.net</a> fame) has some blog posts coming for this exact thing! If he doesn't answer here, I'll create an answer with links when those posts are ready.</p>
  
  <p><strong><em>Edit2</em></strong>: Sankarsan Bose over at <a href="http://codingndesign.com/" rel="nofollow noreferrer">CodingNDesign</a> also has <a href="http://codingndesign.com/blog/?tag=asp-net-mvc-2-0" rel="nofollow noreferrer">posts on the subject</a>. (ModelValidator at the moment). Including here for future reference.</p>