开发者

Is Microsoft pushing Spark or Razor for the future view engine for ASP.NET MVC?

I am planning to learn ASP.NET MVC soon. I wanted to get a clear picture of which view engine should I concentrate on, Spark or Razor? 开发者_开发知识库Which one is Microsoft putting more energy into?


Tony, I'm one of the developers on the ASP.NET MVC team. Here are some thoughts:

We developed Razor because we felt that the Aspx view engine had a number of shortcomings and we felt that we could do a lot better (and I do hope that people will agree that the result is a lot better). We would recommend Razor to anyone starting a new MVC 3 application. Anyone with an existing MVC 2 application and a heavy investment in the WebForms view engine will have to do their own cost/benefit analysis and decide if they want to switch.

Both view engines (Razor and Aspx) will continue to be supported (we are not planning on deprecating WebForms) and we will make sure that existing APIs as well as anything new that we add continue to work in both. That said, it might not always be possible to keep the feature set of each view engine at parity (for example, the @model keyword has no direct analouge in WebForms).

Spark is a 3rd-party component and it remains independent from Microsoft (regardless of the fact that its creator, Louis DeJardin is now employeed here). As such we are not currently contributing any code to it (since we've had our hands quite full with Razor). We are, however, fully committed to exposing all the necessary APIs and extensions points to support 3rd-party view engines. For example, in MVC 3 we have made improvements to the New Project and Add View dialogs to make it easier for the Spark (or any other view engine such as NHaml) developers or community to plug Spark into the built in MVC tooling experience.

Ultimately all options are valid (though in my personal opinion the Aspx view engine is slightly less valid :) and it's up to you to find the one that best fits your needs.


Spark has not been developed by Microsoft and I wouldn't say that they have/intend to put much energy on it. On the other hand Razor is Microsoft child and if you want an MS supported view engine go for it.


If you want to stay w/ Microsoft-supported view engines, then your options are Razor or WebForms. I prefer Razor of the two. Spark is arguably a better view engine than Razor is right now (depending on your sense of style), but as Darin pointed out it's not an MS product, so they're not putting energy into it that I'm aware of.


Razor is the best option if you want to minimize the amount of code in your view and if you like the syntax.

WebForms is good if you have a lot of experience with traditional ASP.NET and like the idea of having a code behind.

Spark is not supported or written by Microsoft.

For me, I use Razor as I like the syntax and I find my views a lot cleaner. Sure it's more verbose than haml, but at the same time it still is valid looking HTML and most web developers will pick it up naturally.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜