剃刀/ CSHTML - 比我们有什么什么好处? [英] Razor/CSHTML - Any Benefit over what we have?

查看:90
本文介绍了剃刀/ CSHTML - 比我们有什么什么好处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人在那里使用新的CSHTML页面功能,并发现他们preFER在现有的ASP.NET MVC默认的视图引擎或通过网络形式这个新的视图引擎的语法,如果是这样,为什么?有关CSHTML什么给你一个优势MVC或网页形式,反之亦然?

Anyone out there using the new CSHTML pages feature and is finding that they prefer this new view engine syntax over the existing ASP.NET MVC default view engine or over web forms, and if so, why? What about CSHTML gives you an advantage over MVC or web forms, or vice versa?

只是好奇地听到它的人的服用。

Just curious to hear people's take on it.

推荐答案

做的好处之一是,剃刀的意见可以在里面的单元测试渲染,这是一件很不容易可以用previous ASP.Net渲染器

One of the benefits is that Razor views can be rendered inside unit tests, this is something that was not easily possible with the previous ASP.Net renderer.

的公告这被列为一体的设计目标:

From ScottGu's announcement this is listed as one of the design goals:

单元测试:新的视图引擎实现将支持的能力,单元测试的看法(无需控制器或网络服务器,并且可以在任何单元测试项目主办 - 没有什么特别的APP-必需的)域。

Unit Testable: The new view engine implementation will support the ability to unit test views (without requiring a controller or web-server, and can be hosted in any unit test project – no special app-domain required).

这篇关于剃刀/ CSHTML - 比我们有什么什么好处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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