asp.net webforms vs mvc,最适合业务应用程序

时间:2022-08-05 03:19:15

Diamonds is an ERP based on windows forms, I'm going to redevelop it using web technologies rather than Windows Forms ..

Diamonds是一个基于Windows窗体的ERP,我将使用Web技术而不是Windows Forms重新开发它。

but now I need to decide which is best for this, the ASP.NET webforms (as i think) is easier to (design) i mean here the UI, but the mvc has simpler html output, and some other features ...

但现在我需要决定哪个最适合这个,ASP.NET webforms(我认为)更容易(设计)我的意思是UI,但mvc有更简单的html输出,以及一些其他功能......

can you help me decide which technology to use and why ?

你能帮我决定使用哪种技术,为什么?

I'm using C#,

我正在使用C#,

Cheers

7 个解决方案

#1


5  

I think both technologies can get a bit complicated after getting past any of the basics. Here are some brief opinions that I gathered while having to implement a project that must live in both MVC and WebForms hosts.

我认为在通过任何基础知识后,这两种技术都会变得有点复杂。以下是我在必须实现必须同时存在于MVC和WebForms主机中的项目时收集的一些简短意见。

WebForms Positives:

  1. The maturity of the product
  2. 产品的成熟度

  3. Lots of 3rd party support with regard to sophisticated controls
  4. 在复杂的控制方面有很多第三方支持

  5. There are ways to get around the legacy-feeling aspects of the framework (e.g., WebForms MVP)
  6. 有办法解决框架的遗留感觉方面(例如,WebForms MVP)

WebForms Negatives:

  1. Page lifecycle issues can anger you to no end; there are a lot of moving parts to a sophisticated web application
  2. 页面生命周期问题可能会让你感到愤怒;复杂的Web应用程序有很多移动部件

  3. Using dependency injection is "difficult" to use/implement
  4. 使用依赖注入是“难以”使用/实现的

  5. There is a lot in the framework that you can't control
  6. 框架中有很多你无法控制的东西

  7. Need something like Reflector to dive into decompiled source when have questions that are not answered by documentation, web, experimentation.
  8. 当有文档,网络,实验无法解答的问题时,需要像Reflector这样的东西潜入反编译源。

MVC Positives:

  1. Great separation of concerns and support of dependency injection
  2. 关注点的大分离和依赖注入的支持

  3. More control over so many things (i.e., project structure, mvc framework, rendered content, etc)
  4. 更多地控制这么多东西(即项目结构,mvc框架,渲染内容等)

  5. You can xcopy deploy your app along with the mvc framework on top of an asp.net 4 installation (i.e., to a 3rd party hosting provider)
  6. 你可以在asp.net 4安装之上xcopy部署你的应用程序和mvc框架(即,到第三方托管服务提供商)

  7. Native support of JSON
  8. JSON的原生支持

  9. Source code (w/ comments!!) provided so that you can dive into various features when you run into questions on the internals.
  10. 提供源代码(带注释!!),以便您在内部问题上遇到问题时可以深入了解各种功能。

  11. They've been doing out-of-band releases on tooling and I believe plan to do so on the framework (?); they have a futures project along with the source that shows you some of the directions they are going and which you could make use of if you should choose to.
  12. 他们一直在使用工具进行带外发布,我相信计划在框架上这样做(?);他们有一个期货项目以及来源,向您展示他们正在进行的一些方向,如果您愿意,可以使用哪些方向。

MVC Negatives:

  1. Can take a little time to wrap one's mind around
  2. 可能需要一点时间来包装一个人的想法

  3. Not as many 3rd party helpers (no controls); those that exist seem to be not as sophisticated as their WebForm counterparts
  4. 没有多少第三方助手(没有控制);那些存在的东西似乎没有WebForm那样复杂

Personally, I'm an MVC fan because of the control, flexibility, and transparent dependency injection support. Perhaps you should do a small pilot with both technologies to see which one you prefer. Good luck and have fun!

就个人而言,由于控制,灵活性和透明的依赖注入支持,我是MVC的粉丝。也许你应该用两种技术做一个小飞行员,看看你喜欢哪一种。祝好运并玩得开心点!

#2


6  

If you care about extensibility, ease of maintenance, scalability and robustness of your application, as well as development of your software development skills, then stay as far away as possible from web forms.

如果您关心应用程序的可扩展性,易维护性,可伸缩性和健壮性,以及开发软件开发技能,那么请尽可能远离Web表单。

The whole idea of adding a layer of state by wrapping everything in a form is just wrong. HTTP is stateless, and MVC is built around that model, which is good.

通过将所有内容包装在表单中来添加状态层的整个想法是错误的。 HTTP是无状态的,MVC是围绕该模型构建的,这很好。

Edit In regards to the comments made. Web forms applications are not extensible because presentation layer, business logic and data access code (data sources) all reside in code behind. Controls that are offered by web forms are applicable only in web forms. This means that you won't be able to transfer these skills to another web development framework.

编辑关于所做的评论。 Web表单应用程序不可扩展,因为表示层,业务逻辑和数据访问代码(数据源)都存在于代码之后。 Web表单提供的控件仅适用于Web表单。这意味着您将无法将这些技能转移到其他Web开发框架。

Finally, of course it is possible to write a tightly coupled application using MVC - there is always a way to destroy something. There is no argument about that. The main point is that MVC encourages a seperation of concerns and single responsibility principle, when web forms practically takes it away from you.

最后,当然可以使用MVC编写一个紧密耦合的应用程序 - 总有一种方法可以破坏某些东西。对此没有任何争论。重点是,当网络形式实际上将它从你身边带走时,MVC鼓励分离关注点和单一责任原则。

You have also said that web forms is easier. It's easier if you have been using it and it's faster to pick up in comparison to MVC, however, in a long-term run MVC is likely to become "easier". Watch few videos on www.asp.net/mvc. Additionally you might want to look into test-driven development (unit-testing). I don't think that unit testing works with web forms because everything is so tightly coupled. Please correct me if i'm wrong.

您还说过Web表单更容易。如果你一直在使用它会更容易,并且与MVC相比它更快,但是,在长期运行中,MVC可能变得“更容易”。观看www.asp.net/mvc上的几个视频。此外,您可能希望研究测试驱动的开发(单元测试)。我不认为单元测试适用于Web表单,因为一切都紧密耦合。如果我错了,请纠正我。

I would be very interested to hear opinions of other developers who have experience of working with both frameworks.

我很想听听其他有两种框架经验的开发人员的意见。

#3


4  

I strongly recommend MVC simply because once the UI is ironed out, it makes development so much easier from a back-end viewpoint. There are TONS of mvc vs asp questions out there: 1, 2, 3

我强烈推荐使用MVC,因为一旦用户界面被解决了,它就会从后端的角度让开发变得更加容易。有很多mvc vs asp问题:1,2,3

From my perspective MVC wins based solely on TDD and no Viewstate. But it really depends on how you plan to manage and use the various features of either.

从我的角度来看,MVC完全基于TDD并且没有Viewstate。但这实际上取决于您计划如何管理和使用其中任何一种功能。

#4


2  

I think this post from Scott Guthrie is really interesting to read. After reading, I think you'll most likely go for ASP.NET MVC. :-)

我认为Scott Guthrie的这篇文章非常有趣。阅读后,我认为你很可能会选择ASP.NET MVC。 :-)

#5


1  

While I have done plenty of projects with web forms, I have to say that the primary reason they exist is to provide a layer of abstraction over HTTP, largely to facilitate an event-based model on a stateless protocol. Unfortunately, like most MS solutions, that comes at a price.

虽然我已经使用Web表单完成了大量项目,但我不得不说它们存在的主要原因是通过HTTP提供一个抽象层,主要是为了促进无状态协议上基于事件的模型。不幸的是,像大多数MS解决方案一样,这需要付出代价。

Historically, web forms used to be plagued with issues around the generation of markup. Some of these issues still persist today, especially when it comes to ViewState. Things are slightly better now( you can manage the DOM id in ASP .NET 4.0 ) but web forms will still cause you grief. Common things you'll see in web form projects are vast amounts of biz logic squirreled away in codebehind.

从历史上看,Web表单过去常常伴随着标记生成的问题。其中一些问题在今天仍然存在,特别是在涉及ViewState时。现在情况稍好一些(你可以在ASP .NET 4.0中管理DOM id),但是web表单仍会让你感到悲伤。您将在Web表单项目中看到的常见事物是代码隐藏中存在的大量业务逻辑。

MVC doesn't eliminate this, but it provides a structure and separation of concerns that makes bad practice less likely. That said, although the default view engine is better at producing clean markup from an end-user perspective, the inline code in views is a throwback to classic ASP.

MVC并没有消除这一点,但它提供了一种结构和分离的关注点,这使得不良实践的可能性降低。也就是说,虽然默认的视图引擎更好地从最终用户的角度生成干净的标记,但视图中的内联代码是对传统ASP的回归。

For what it's worth, I've stopped developing web form projects and have moved exclusively to MVC for new work.

为了它的价值,我已经停止开发Web表单项目,并且已经专门转移到MVC进行新工作。

#6


1  

IMHO MVC

I had to write a report to justify changing to MVC from Web Forms/Nettiers

我必须编写一份报告来证明从Web Forms / Nettiers更改为MVC是正确的

I blogged my arguments here

我在这里写了我的论点

#7


0  

It's all about your choice having Web Forms can give you easy of designing your app where as MVC is now days becoming industry standard and even MS is promoting it a lot. If you want to keep your code clean then no doubt MVC is better choice.

这一切都与您的选择有关,Web Forms可以让您轻松设计您的应用程序,因为MVC现在已经成为行业标准,甚至MS也在推广它。如果你想保持你的代码清洁,毫无疑问MVC是更好的选择。

#1


5  

I think both technologies can get a bit complicated after getting past any of the basics. Here are some brief opinions that I gathered while having to implement a project that must live in both MVC and WebForms hosts.

我认为在通过任何基础知识后,这两种技术都会变得有点复杂。以下是我在必须实现必须同时存在于MVC和WebForms主机中的项目时收集的一些简短意见。

WebForms Positives:

  1. The maturity of the product
  2. 产品的成熟度

  3. Lots of 3rd party support with regard to sophisticated controls
  4. 在复杂的控制方面有很多第三方支持

  5. There are ways to get around the legacy-feeling aspects of the framework (e.g., WebForms MVP)
  6. 有办法解决框架的遗留感觉方面(例如,WebForms MVP)

WebForms Negatives:

  1. Page lifecycle issues can anger you to no end; there are a lot of moving parts to a sophisticated web application
  2. 页面生命周期问题可能会让你感到愤怒;复杂的Web应用程序有很多移动部件

  3. Using dependency injection is "difficult" to use/implement
  4. 使用依赖注入是“难以”使用/实现的

  5. There is a lot in the framework that you can't control
  6. 框架中有很多你无法控制的东西

  7. Need something like Reflector to dive into decompiled source when have questions that are not answered by documentation, web, experimentation.
  8. 当有文档,网络,实验无法解答的问题时,需要像Reflector这样的东西潜入反编译源。

MVC Positives:

  1. Great separation of concerns and support of dependency injection
  2. 关注点的大分离和依赖注入的支持

  3. More control over so many things (i.e., project structure, mvc framework, rendered content, etc)
  4. 更多地控制这么多东西(即项目结构,mvc框架,渲染内容等)

  5. You can xcopy deploy your app along with the mvc framework on top of an asp.net 4 installation (i.e., to a 3rd party hosting provider)
  6. 你可以在asp.net 4安装之上xcopy部署你的应用程序和mvc框架(即,到第三方托管服务提供商)

  7. Native support of JSON
  8. JSON的原生支持

  9. Source code (w/ comments!!) provided so that you can dive into various features when you run into questions on the internals.
  10. 提供源代码(带注释!!),以便您在内部问题上遇到问题时可以深入了解各种功能。

  11. They've been doing out-of-band releases on tooling and I believe plan to do so on the framework (?); they have a futures project along with the source that shows you some of the directions they are going and which you could make use of if you should choose to.
  12. 他们一直在使用工具进行带外发布,我相信计划在框架上这样做(?);他们有一个期货项目以及来源,向您展示他们正在进行的一些方向,如果您愿意,可以使用哪些方向。

MVC Negatives:

  1. Can take a little time to wrap one's mind around
  2. 可能需要一点时间来包装一个人的想法

  3. Not as many 3rd party helpers (no controls); those that exist seem to be not as sophisticated as their WebForm counterparts
  4. 没有多少第三方助手(没有控制);那些存在的东西似乎没有WebForm那样复杂

Personally, I'm an MVC fan because of the control, flexibility, and transparent dependency injection support. Perhaps you should do a small pilot with both technologies to see which one you prefer. Good luck and have fun!

就个人而言,由于控制,灵活性和透明的依赖注入支持,我是MVC的粉丝。也许你应该用两种技术做一个小飞行员,看看你喜欢哪一种。祝好运并玩得开心点!

#2


6  

If you care about extensibility, ease of maintenance, scalability and robustness of your application, as well as development of your software development skills, then stay as far away as possible from web forms.

如果您关心应用程序的可扩展性,易维护性,可伸缩性和健壮性,以及开发软件开发技能,那么请尽可能远离Web表单。

The whole idea of adding a layer of state by wrapping everything in a form is just wrong. HTTP is stateless, and MVC is built around that model, which is good.

通过将所有内容包装在表单中来添加状态层的整个想法是错误的。 HTTP是无状态的,MVC是围绕该模型构建的,这很好。

Edit In regards to the comments made. Web forms applications are not extensible because presentation layer, business logic and data access code (data sources) all reside in code behind. Controls that are offered by web forms are applicable only in web forms. This means that you won't be able to transfer these skills to another web development framework.

编辑关于所做的评论。 Web表单应用程序不可扩展,因为表示层,业务逻辑和数据访问代码(数据源)都存在于代码之后。 Web表单提供的控件仅适用于Web表单。这意味着您将无法将这些技能转移到其他Web开发框架。

Finally, of course it is possible to write a tightly coupled application using MVC - there is always a way to destroy something. There is no argument about that. The main point is that MVC encourages a seperation of concerns and single responsibility principle, when web forms practically takes it away from you.

最后,当然可以使用MVC编写一个紧密耦合的应用程序 - 总有一种方法可以破坏某些东西。对此没有任何争论。重点是,当网络形式实际上将它从你身边带走时,MVC鼓励分离关注点和单一责任原则。

You have also said that web forms is easier. It's easier if you have been using it and it's faster to pick up in comparison to MVC, however, in a long-term run MVC is likely to become "easier". Watch few videos on www.asp.net/mvc. Additionally you might want to look into test-driven development (unit-testing). I don't think that unit testing works with web forms because everything is so tightly coupled. Please correct me if i'm wrong.

您还说过Web表单更容易。如果你一直在使用它会更容易,并且与MVC相比它更快,但是,在长期运行中,MVC可能变得“更容易”。观看www.asp.net/mvc上的几个视频。此外,您可能希望研究测试驱动的开发(单元测试)。我不认为单元测试适用于Web表单,因为一切都紧密耦合。如果我错了,请纠正我。

I would be very interested to hear opinions of other developers who have experience of working with both frameworks.

我很想听听其他有两种框架经验的开发人员的意见。

#3


4  

I strongly recommend MVC simply because once the UI is ironed out, it makes development so much easier from a back-end viewpoint. There are TONS of mvc vs asp questions out there: 1, 2, 3

我强烈推荐使用MVC,因为一旦用户界面被解决了,它就会从后端的角度让开发变得更加容易。有很多mvc vs asp问题:1,2,3

From my perspective MVC wins based solely on TDD and no Viewstate. But it really depends on how you plan to manage and use the various features of either.

从我的角度来看,MVC完全基于TDD并且没有Viewstate。但这实际上取决于您计划如何管理和使用其中任何一种功能。

#4


2  

I think this post from Scott Guthrie is really interesting to read. After reading, I think you'll most likely go for ASP.NET MVC. :-)

我认为Scott Guthrie的这篇文章非常有趣。阅读后,我认为你很可能会选择ASP.NET MVC。 :-)

#5


1  

While I have done plenty of projects with web forms, I have to say that the primary reason they exist is to provide a layer of abstraction over HTTP, largely to facilitate an event-based model on a stateless protocol. Unfortunately, like most MS solutions, that comes at a price.

虽然我已经使用Web表单完成了大量项目,但我不得不说它们存在的主要原因是通过HTTP提供一个抽象层,主要是为了促进无状态协议上基于事件的模型。不幸的是,像大多数MS解决方案一样,这需要付出代价。

Historically, web forms used to be plagued with issues around the generation of markup. Some of these issues still persist today, especially when it comes to ViewState. Things are slightly better now( you can manage the DOM id in ASP .NET 4.0 ) but web forms will still cause you grief. Common things you'll see in web form projects are vast amounts of biz logic squirreled away in codebehind.

从历史上看,Web表单过去常常伴随着标记生成的问题。其中一些问题在今天仍然存在,特别是在涉及ViewState时。现在情况稍好一些(你可以在ASP .NET 4.0中管理DOM id),但是web表单仍会让你感到悲伤。您将在Web表单项目中看到的常见事物是代码隐藏中存在的大量业务逻辑。

MVC doesn't eliminate this, but it provides a structure and separation of concerns that makes bad practice less likely. That said, although the default view engine is better at producing clean markup from an end-user perspective, the inline code in views is a throwback to classic ASP.

MVC并没有消除这一点,但它提供了一种结构和分离的关注点,这使得不良实践的可能性降低。也就是说,虽然默认的视图引擎更好地从最终用户的角度生成干净的标记,但视图中的内联代码是对传统ASP的回归。

For what it's worth, I've stopped developing web form projects and have moved exclusively to MVC for new work.

为了它的价值,我已经停止开发Web表单项目,并且已经专门转移到MVC进行新工作。

#6


1  

IMHO MVC

I had to write a report to justify changing to MVC from Web Forms/Nettiers

我必须编写一份报告来证明从Web Forms / Nettiers更改为MVC是正确的

I blogged my arguments here

我在这里写了我的论点

#7


0  

It's all about your choice having Web Forms can give you easy of designing your app where as MVC is now days becoming industry standard and even MS is promoting it a lot. If you want to keep your code clean then no doubt MVC is better choice.

这一切都与您的选择有关,Web Forms可以让您轻松设计您的应用程序,因为MVC现在已经成为行业标准,甚至MS也在推广它。如果你想保持你的代码清洁,毫无疑问MVC是更好的选择。