MVC的UpdateModel可以使用企业库VAB? [英] Can MVC UpdateModel use Enterprise Library VAB?

查看:148
本文介绍了MVC的UpdateModel可以使用企业库VAB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

...或者我应该说,有什么用企业库5 VAB与MVC最彻底的方法?

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

我目前使用的格式为:

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

   UpdateModel(model);

   somehowvalidate(model);

   if(ModelState.IsValid)
   {

etc...

能否VAB装饰类来自动地通过验证的UpdateModel,还是我手动得到验证,并且调用后验证呢?
还是有更好的办法呢?

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?

推荐答案

看来,我并不需要做任何事情。 MVC本身拿起VAB属性。
这是企业库5.0。

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.

哇!

这篇关于MVC的UpdateModel可以使用企业库VAB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆