We are planning to use ASP.NET MVC on a relatively important (to the business) project. The development team comprises 4 developers and a Technical Lead. 2 of the devs and the Tech Lead have worked together before on ASP.NET WebForms project and are confident using that technology.
我们计划在相对重要的(对业务)项目中使用ASP.NET MVC。开发团队由4名开发人员和技术主管组成。两位开发人员和Tech Lead之前曾在ASP.NET WebForms项目上合作过,并对使用该技术充满信心。
We cringe a little when we look back at some of the approaches used on some of our first WebForms project (examples include excessive use of UpdatePanels, lack of knowledge of controls such as the ListView, bloated ViewState etc).
当我们回顾一些第一个WebForms项目中使用的一些方法时,我们会有点畏缩(例子包括过度使用UpdatePanels,缺乏对ListView等控件的知识,膨胀的ViewState等)。
It is important that we do not look back on this project in a year and cringe at some of our ASP.NET MVC approaches!
重要的是,我们不要在一年内回顾这个项目,并对我们的一些ASP.NET MVC方法感到畏缩!
Based on experience, does anyone have any key risks they can cite when using ASP.NET MVC for the first time?
根据经验,在第一次使用ASP.NET MVC时,是否有任何人可以引用任何关键风险?
I am thinking about gotchas, lightbulbs that took a while to go on, parts of the framework that you felt you were fighting until you learnt a specific item, that sort of thing.
我正在考虑陷阱,需要一段时间才能继续运行的灯泡,你觉得自己正在战斗的框架的一部分,直到你学会了一个特定的项目,那种事情。
4 个解决方案
#1
2
The biggest risks that I've seen come from a return to a stateless medium.
我看到的最大风险来自于回归无国籍媒体。
Postback is gone. Most server controls are gone. Viewstate is gone. Event driven model is gone.
回发消失了。大多数服务器控件都没了。 Viewstate消失了。事件驱动的模型消失了。
If your devs have ONLY used asp.net webforms to build sites, and never another web technology, they are in for a lot of learning.
如果您的开发人员只使用asp.net webforms来构建网站,而且从不使用其他网络技术,那么他们就可以进行大量的学习。
#2
7
Use Strongly Typed Views and create a new Model for each view
使用强类型视图并为每个视图创建新模型
Simple reason: That is to make sure your Model is separted from your View. If you need to do refactoring, you only break one part. So if you have a View called "Latest News", you should have a "LatestNewsViewModel". It's then the job of the controller to get the data from the actual Model/Database and create a View Model that it passed into your views. Also, if you decide that you need additional stuff in your View, you don't have to refactor the entire Data Access Layer, as you only have to change the ViewModel and the Controller action that populates it.
原因很简单:这是为了确保您的模型与View分开。如果你需要进行重构,你只能打破一个部分。因此,如果您有一个名为“最新消息”的视图,您应该有一个“LatestNewsViewModel”。然后控制器的工作是从实际的模型/数据库中获取数据并创建一个传递到视图中的视图模型。此外,如果您决定在View中需要其他内容,则无需重构整个数据访问层,因为您只需要更改ViewModel和填充它的Controller操作。
Performance
性能
I recommend checking out this slideshow about performance concerns and optimizations which can make a huge impact.
我建议查看此幻灯片,了解可能产生巨大影响的性能问题和优化。
#3
2
You can download a free eBook from Scotts Guthrie's blog take gives you a full in-depth guide on how to build an ASP.NET MVC site from scratch.
您可以从Scotts Guthrie的博客下载免费电子书,为您提供有关如何从头构建ASP.NET MVC站点的完整深入指南。
#4
0
The biggest ones for me were understanding Model Binding and that you can have typed views.
对我来说最大的是理解模型绑定,你可以有类型化的视图。
Also properly securing your routes.
还要正确保护您的路线。
#1
2
The biggest risks that I've seen come from a return to a stateless medium.
我看到的最大风险来自于回归无国籍媒体。
Postback is gone. Most server controls are gone. Viewstate is gone. Event driven model is gone.
回发消失了。大多数服务器控件都没了。 Viewstate消失了。事件驱动的模型消失了。
If your devs have ONLY used asp.net webforms to build sites, and never another web technology, they are in for a lot of learning.
如果您的开发人员只使用asp.net webforms来构建网站,而且从不使用其他网络技术,那么他们就可以进行大量的学习。
#2
7
Use Strongly Typed Views and create a new Model for each view
使用强类型视图并为每个视图创建新模型
Simple reason: That is to make sure your Model is separted from your View. If you need to do refactoring, you only break one part. So if you have a View called "Latest News", you should have a "LatestNewsViewModel". It's then the job of the controller to get the data from the actual Model/Database and create a View Model that it passed into your views. Also, if you decide that you need additional stuff in your View, you don't have to refactor the entire Data Access Layer, as you only have to change the ViewModel and the Controller action that populates it.
原因很简单:这是为了确保您的模型与View分开。如果你需要进行重构,你只能打破一个部分。因此,如果您有一个名为“最新消息”的视图,您应该有一个“LatestNewsViewModel”。然后控制器的工作是从实际的模型/数据库中获取数据并创建一个传递到视图中的视图模型。此外,如果您决定在View中需要其他内容,则无需重构整个数据访问层,因为您只需要更改ViewModel和填充它的Controller操作。
Performance
性能
I recommend checking out this slideshow about performance concerns and optimizations which can make a huge impact.
我建议查看此幻灯片,了解可能产生巨大影响的性能问题和优化。
#3
2
You can download a free eBook from Scotts Guthrie's blog take gives you a full in-depth guide on how to build an ASP.NET MVC site from scratch.
您可以从Scotts Guthrie的博客下载免费电子书,为您提供有关如何从头构建ASP.NET MVC站点的完整深入指南。
#4
0
The biggest ones for me were understanding Model Binding and that you can have typed views.
对我来说最大的是理解模型绑定,你可以有类型化的视图。
Also properly securing your routes.
还要正确保护您的路线。