什么是关键概念,要知道从ASP.NET迁移我的心态时,ASP.NET MVC(2)?我的、要知道、心态、概念

2023-09-04 02:45:58 作者:三生三世桃花缘

我目前正与ASP.NET和即将开始学习ASP.NET MVC(2)。 所以,在我打开第一本厚厚的书,并经过第一长教程,什么是最重要的(新)的概念要记住?有哪些主要的新功能,我应该知道的?

I'm currently working with ASP.NET and about to start learning ASP.NET MVC (2). So before I open the first thick book and go through the first lengthy tutorial, what are the most important (new) concepts to keep in mind? What are the main new features I should be aware of?

多谢了。

推荐答案

没有视图状态。没有服务器端控件。想想REST风格的/无状态;它是一个请求/响应循环,而不是一个事件被处理

No viewstate. No server-side controls. Think RESTful/stateless; it's a request/response cycle, not an event being handled.

这是值得考虑采取顺道到的Ruby / Rails的完全学习概念的.NET堆栈之外你解决MVC之前。我知道,我是能够迅速捡起来pretty的,因为我已经涉足的Ruby / Rails的足够熟悉的模式。

It's worth consideration to take a side trip into Ruby/Rails to learn the concepts completely outside the .NET stack before you tackle MVC. I know that I was able to pick it up pretty quickly because I had already dabbled in Ruby/Rails enough to be familiar with the paradigm.

修改:我还要补充一点,我觉得从商业模式(实体)分离视图模型是一个好主意。你绝对应该使用强类型的意见,并通过模型周围,而不是通过非类型化的ViewData大家的意见和拉动直接请求或值提供无类型数据。使用模型和决策模型具约束力的框架工作,你将能够更容易既考验,并保持你的意见干净。在视图中使用强类型数据将至少给你一些编译时检查那里。

EDIT: I would also add that I find that separating view models from business models (entities) is a good idea. You should definitely be using strongly-typed views and passing models around rather than passing "untyped" ViewData to your views and pulling "untyped" data from the request or value providers directly. Using models and making the model-binding framework work for you will make it much easier both to test and keep your views cleaner. Using strongly-typed data in your views will at least give you some compile-time checking there as well.