被抓尝试在视图中不好的做法? [英] Is try catch in a view bad practice?
本文介绍了被抓尝试在视图中不好的做法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在一个MVC3应用程序,是它认为不好的做法,使用try catch块内剃刀块 @ {}
在 .cshtml
看法?
In an MVC3 application, is it considered bad practice to use a try catch block inside of a razor block @{ }
in the .cshtml
view?
推荐答案
正是这样。
视图不应包含任何真正的逻辑;任何可能会抛出异常所属的控制器。
Views should not contain any real logic; anything that might throw an exception belongs in the controller.
这篇关于被抓尝试在视图中不好的做法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文