1

I am working on MVC3. not sure whether its the right question but it keeps on bothering me always.

I have a generic model used by multiple views. If i make any changes to the model variables for example name change it does not reflect in any of the views nor does it throw any compile time errors. The errors are thrown only at run time.

This can cause a serious issue if model changes are not checked for in each view manually.

Is there any way to overcome this manual changes in the view?

4

2 回答 2

1

有两件事可以提供帮助。第一个是T4MVC,尽管这实际上更多是为了让你的助手在编译时更安全。这本身不会有帮助。如果您还遵循这些说明,那么它还将编译您的视图并捕获大多数这些错误。

但是请注意,编译视图会显着减慢构建过程。

于 2013-04-17T07:30:36.047 回答
0

不...这是您在“修复”模型时必须注意的事情。

由于模型在运行时被评估,就像ViewBagand一样ViewData,您将不得不手动更新更改。

我想你可以用一个不错的“搜索和替换”来更新更改

于 2013-04-17T06:49:50.653 回答