asp.net-mvcenterprise-libraryvalidation-application-bl

Can MVC UpdateModel use Enterprise Library VAB?


...or should I say, what's the cleanest way to use Enterprise Library 5 VAB with MVC?

I currently use the form:

ActionResult Save(int id, FormCollection form)
{
   SomeModel model = somehowgetbyid(id);

   UpdateModel(model);

   somehowvalidate(model);

   if(ModelState.IsValid)
   {

etc...

Can VAB decorated classes be validated automagically by updatemodel, or do I get the validator manually and validate it after that call? Or are there even better ways?


Solution

  • It seems that I didn't need to do anything. MVC picks up the VAB attributes by itself. This is for Enterprise Library 5.0.

    Wow!