简体   繁体   English

ASP.NET MVC和数据密集型应用程序

[英]ASP.NET MVC and data heavy applications

I've been learning ASP.NET MVC for about a month now and I'm certainly sold on its benefits but I realize it is not applicable to all situations. 我已经学习ASP.NET MVC大约一个月了,我当然可以从中受益,但是我意识到它并不适用于所有情况。

I've read in several places that ASP.NET MVC is not ideal for data-intensive applications: 我已经在多个地方读到ASP.NET MVC对于数据密集型应用程序不是理想的选择:

  • Example 1 : "Data Driven Application – life would be MUCH easier using WebForms if the application is data heavy" 例1 :“数据驱动的应用程序-如果应用程序数据量很大,使用WebForms可以使生活更加轻松”
  • Example 2 : Nick Berardi's book suggests that you side with Web forms if your application is "data-heavy" 示例2 :Nick Berardi的书建议您在应用程序“数据繁重”的情况下支持Web表单

Can someone clarify as to why ASP.NET MVC is ill-suited towards data-heavy applications and why Web forms are more appropriate? 有人可以澄清为什么ASP.NET MVC不适合于数据密集型应用程序,以及Web表单为什么更合适吗? Also, where does one draw the line between data-heavy applications and other applications? 另外,在繁重的数据应用程序与其他应用程序之间划界线的地方是什么? Are we talking quantity of data (millions of records) or are we talking large data models? 我们在谈论数据量(数百万条记录)还是在谈论大型数据模型?

I would really like this clarified as well, as I have found the exact opposite to be true, and I think stackoverflow.com is evidence of the suitability of MVC to data-driven apps. 我也确实希望澄清这一点,因为我发现完全相反的事实,并且我认为stackoverflow.com证明了MVC适用于数据驱动的应用程序。

I didn't bother reading much of the second link, but the assertions in the first are not qualified, and many of them seem wrong to me. 我并没有花太多时间去阅读第二个链接,但是第一个链接中的断言是不合格的,其中许多断言对我来说似乎是错误的。 The stated weaknesses of WebForms, though, would be enough to drive me from using it for a data-intensive app: 但是,WebForms所陈述的弱点足以使我免于将其用于数据密集型应用程序:

  • UI logic coupled with the code, and thus is hard to separate. UI逻辑与代码耦合,因此很难分开。
  • Harder to unit test, so difficult to employ TDD. 难以进行单元测试,因此难以使用TDD。
  • Heavy page sizes due to view state management. 页面大,归因于视图状态管理。

The stated weaknesses of MVC are quite flimsy: MVC所说的缺点非常脆弱:

  • Not event driven, so maybe difficult for people who know only Asp.Net Webforms to wrap their minds around it. 由于不是事件驱动的,所以对于仅了解Asp.Net Webforms的人来说,可能很难全神贯注于此。
  • Third party control library support is not that strong. 第三方控制库的支持并不强大。
  • No ViewState(this is also a strength). 没有ViewState(这也是一种优势)。

The first one can be seen as a plus as much as minus. 第一个可以看作是负号。 The second is just wrong as MVC apps can leverage traditional server-side controls if they wish, as well as make use of the rich library of client-side controls and libraries. 第二个是错误的,因为MVC应用程序可以根据需要利用传统的服务器端控件,并利用客户端控件和库的丰富库。 The third, well I don't think I even need to speak to that one... 第三,嗯,我认为我什至不需要和那个说话。

You have to be wary when reading articles like this on the internet - they sound authoritative and comprehensive, but where is the meat? 在互联网上阅读此类文章时,您必须保持警惕-它们听起来权威且全面,但是其中的肉在哪里? Why are the stated weaknesses an issue? 为什么陈述的弱点是一个问题? It is not enough to just throw opinion out there as fact. 仅仅把观点当作事实是不够的。 They should be backed up with metrics, such as when using platform x over y, developers unfamiliar with either platform were able to complete an application 30% faster, or platform x resulted in 25% fewer lines of code, or fewer levels of indirection, or whatever. 他们应使用指标进行备份,例如当使用y平台x时,不熟悉任一平台的开发人员能够以30%的速度完成应用程序,或者平台x的代码行减少25%或间接层更少,管他呢。

The idea that RAD is a plus is another one that bears careful examination: RAD is fast until you want to do something a particular control was not designed for, and then you hit a brick wall. RAD是一个加号的想法是另一个需要仔细检查的想法:RAD很快,直到您想要执行某项特定于特定控件的操作,然后碰到一堵墙。 It is a leaky abstraction and when it fails, you are suddenly confronted with the full complexity of understanding the design framework and code of the given control. 这是一个泄漏性的抽象 ,当它失败时,您会突然面对理解给定控件的设计框架和代码的全部复杂性。 This can be quite a setback, and the source code for these controls is not always available. 这可能是一个很大的挫折,并且这些控件的源代码并不总是可用。

Doesn't make much sense to me. 对我来说没有多大意义。 They might be speculating on the difficulty of creating many models if you have lots of different types of data, or perhaps the relative difficulty of creating web forms in MVC. 如果您拥有许多不同类型的数据,他们可能会猜测创建多个模型的困难,或者可能是在MVC中创建Web表单的相对困难。

However, ORMs (such as L2Sql, EF and Subsonic), model binders , and form generators (I can't find the link right now) pretty much hose those arguments. 但是,ORM(例如L2Sql,EF和Subsonic), 模型联编程序和表单生成器(我现在找不到链接)几乎可以用这些参数。

Frankly I don't buy it. 坦白说,我不买。

I believe that these authors are talking about the ability to drag/drop data controls onto the page such as GridViews, FormViews, and other databound objects. 我相信这些作者正在谈论将数据控件拖放到页面上的能力,例如GridViews,FormViews和其他数据绑定对象。

Say you have a database for your IT department, with a table for computers, a table for printers, one for software, etc. The UI for this is a very simple data management system, essentially a glorified MS Access. 假设您有一个IT部门的数据库,其中有一个计算机表,一个打印机表,一个软件表等。此UI是一个非常简单的数据管理系统,本质上是一种美化的MS Access。

Rather than writing an elegant web app, with beautiful HTML and a class library, you could simply create a quick/dirty WebForms app by dragging your data sources and controls onto the page in Visual Studio. 您无需编写带有精美HTML和类库的优雅Web应用程序,只需将数据源和控件拖到Visual Studio中的页面上,即可创建快速/肮脏的WebForms应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM