事情我不能在ASP.NET MVC做 [英] Things I cannot do in ASP.NET MVC

查看:206
本文介绍了事情我不能在ASP.NET MVC做的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一些事情我不能跟ASP.NET MVC吗?
事情是只能使用ASP.NET的WebForms,
或的非常的用的WebForms更容易?

Are there some things I cannot do with ASP.NET MVC? Things that are only possible with ASP.NET WebForms, or extremely much easier with WebForms?

我们考虑使用ASP.NET MVC的一个新项目。
但我不知道是否有一些明显的事情,我们将无法在ASP.NET MVC做比较时的WebForms,或者我们将不得不花费大量的时间和ASP.NET MVC的地方。

We consider using ASP.NET MVC for a new project. But I wonder if there are some obvious things we will not be able to do with ASP.NET MVC when compared to WebForms, or places where we will have to spend a lot of time with ASP.NET MVC.

推荐答案

最大的一个是使用窗体上现有的第三方控件。大多数内置控件是pretty容易复制,但如果你有一个宠物第三方控件,您可能必须拥有一个常规(非MVC)aspx页面上(luckliy这是支持)。

The biggest one would be using existing 3rd party controls on your form. Most of the inbuilt controls are pretty easy to reproduce, but if you have a pet 3rd party control, you might have to host that on a regular (non-MVC) aspx page (luckliy this is supported).

同样,Web部件

另外 - 在ASP.NET使用不同的HTML为不同的客户(手机等)成为...不同的功能;你不会希望用手工做到这一点,但实际上大多数客户现在标准的HTML工作,所以这是摆在首位不再是一个问题。

Also - the feature where ASP.NET uses different html for different clients (mobile, etc) becomes... different; you wouldn't want to do this by hand, but in reality most clients now work with standard html, so it is less of an issue in the first place.

通过RESX文件,如国际化有些东西需要额外的工作比在香草MVC模板,但样品是有在互联网上。

Some things like i18n via resx files need extra work than is in the vanilla MVC template, but the samples are there on the internet.

有一点... MVC只对MS / ASP.NET许可;这么一件事你不能这样做(在不违反条款,按我的理解)是单声道/ Apache的运行它 - 但IANAL

One point... MVC is licensed only for MS/ASP.NET; so one thing you can't do (without violating the terms, as I understand it) is to run it in mono/Apache - but IANAL.

现在香草考虑您的事情能做MVC,你不能(或者很难):

Now consider the things you can do with MVC, that you can't (or are hard) with vanilla:


  • 的路线,而不是网页

  • 自动输入分辨率(动作参数)

  • 正确的HTML控制...

  • ... jQuery的实现等,为简单的AJAX

  • 的关注点分离

  • 可测性

  • 的IoC / DI

  • 多个模板选项(而不仅仅是ASPX / ASCX)


再输入分辨率:

public ActionResult Show(string name, int? page, int? pageSize) {...}

将选择姓名,网页和pageSize的关(任意)的路线,查询字符串或窗体 - 所以你不必花费大量的时间挑选出请求值

will pick "name", "page" and "pageSize" off (any of) the route, query-string or form - so you don't have to spend lots of time picking out request values.

再模板 - ASPX / ASCX并不是唯一的模板选项。例如,请参见 href=\"http://stackoverflow.com/questions/173207/best-template-engine-for-asp-net-mvc\">;或者你可以写你自己的,如果你喜欢...的观点是不依赖于ASP.NET控件的所有

re templates - aspx/ascx aren't the only templating options. For example, see here; or you can write your own if you like... The view is not tied to ASP.NET controls at all.

这篇关于事情我不能在ASP.NET MVC做的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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