微软将要推出自己的MVC框架(altnetconf - Scott Guthrie announces ASP.NET MVC framework at Alt.Net Conf)

原创 2007年10月08日 13:34:00
/*评
相信这是很多像我这样正在做企业asp.net开发的同志们正在做或者已经做的一件事情。但不管怎么样,微软要做咱还真拦不住人家。而且也确实是好事,省的人家老喊支持企业开发,结果连一个像样的企业Framework都没有。别说人家还真支持,只不过是另一个产品。。。。。。
但愿这次不要先搅屎,尽管这是微软一贯的风格。还要感谢开源对微软的压力啊!
*/

URL:http://codebetter.com/blogs/jeffrey.palermo/archive/2007/10/05/altnetconf-scott-guthrie-announces-asp-net-mvc-framework-at-alt-net-conf.aspx

altnetconf - Scott Guthrie announces ASP.NET MVC framework at Alt.Net Conf

Scott Guthrie proposed a topic at the Alt.Net Conference today, and the topic was an overview of the MVC Framework his team is working on.  His topic is actually the first timeslot of the conference at 9:30am tomorrow morning.  Just about everyone showed interest, so I wouldn't be surprised to see most of the folks just listening.

Scott and I had supper after the opening, and I received a personal demo of the prototype.  First, here are some of the goals:

  • Natively support TDD model for controllers.
  • Provide ASPX (without viewstate or postbacks) as a view engine
  • Provide a hook for other view engines from MonoRail, etc.
  • Support IoC containers for controller creation and DI on the controllers
  • Provide complete control over URLs and navigation
  • Be pluggable throughout
  • Separation of concerns
  • Integrate nicely within ASP.NET
  • Support static as well as dynamic languages

I'm sure I missed some of the goals, and more people will blog their takeaways since this all is public information.

The first question might be: Is webforms going away?  Do I have to rewrite my web applications?  Some people might wish, but no.  Both models will be supported and even be supported within the same web application.  I, for one, after seeing this, think it is very good, and my company will be recommending it to our clients.

We might get a public CTP by the end of the year, and it will be released in a similar fashion as ASP.NET AJAX was, as an add-on after the Visual Studio 2008 release some time next year.

URLs

The default URL scheme will look something like this:

/<RouteName>/<Action>/<Param1>/<Param2>

where RouteName is configured to map to SomeController.  Multiple routes can map to the same controller for the purpose of providing more URLs (think SEO).

The developer can completely override the URL processing also by providing an implementation of an interface. 

Controllers

Controllers will inherit from a base class by default, but it doesn't hinder unit testing, and it's not even required.  I'll probably use the option of implementing the IController interface instead and creating a controller factory to support controller creation using my IoC container of choice (currently StructureMap).  In this manner, I implement an interface with one method that accepts IHttpContext (yep, we have an interface now), and RouteData, a simple DTO that includes the action and parameters for the web request (parsed from the URL scheme you are using).

Views

Like I said before, NVelocity, Brail, etc can be bolted on as view engines, and ASPX is provided as a view engine (the only thing that has been changed is that the code-behind will inherit from ViewPage as opposed to the current Page).  Controllers can either using IViewEngine (I think that's the name) to request a view by name (key) or using a helper method on the optional controller base class RenderView(string, viewData).  The default model uses a DTO for the objects passed to the view, so it is similar to MonoRail's property bag except it's a strongly-typed DTO (using generics for that), so when you rename stuff with Resharper, you don't have to worry about any string literals lying around.

My impressions

I first saw the early prototype in March of this year, and I was encouraged.  I was able to give some early feedback, which has already been encorporated into the product.  I'm not one to promote a Microsoft offering just because it's there (I have never recommended the use of MSTest over NUnit, for instance), but I will say this: As soon as I can get my hands on a build, I will be building something with it.  I am very encouraged by this, and I think they are going in the right direction.  While they have chosen a model to use with demos, they have broken down the walls.  Interfaces abound, and none of it is sealed.  I will start by swapping out the controller factory so I can get my IoC container in the mix, but it's easy to do.  For testing, there is no coupling of the controller.  The views are decoupled.  The httpcontext is decoupled with the new IHttpContext interface.  The actions are simple public methods with an attribute attached to them ([ControllerAction], I think).

Isn't it just like MonoRail?

Someone using MonoRail for more serious project than me can comment more intelligently, but here goes.  MonoRail is MVC.  This is MVC, so yes, it's very similar but different.  This gives us a controller that executes before a view ever comes into play, and it simplifies ASPX as a view engine by getting rid of viewstate and server-side postbacks with the event lifecycle.  That's about it.  MonoRail is much more.  MonoRail has tight integration with Windsor, ActiveRecord and several view engines.  MonoRail is more than just the MVC part.  I wouldn't be surprised if MonoRail were refactored to take advantage of the ASP.NET MVC HttpHandler just as a means to reduce the codebase a bit.  I think it would be a very easy move, and it would probably encourage MonoRail adoption (even beyond its current popularity).


  <script type="text/javascript"><!-- google_ad_client = "pub-2707591418901931"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "text_image"; //2007-10-13: UML, Asp.net, C#, Web, Windows google_ad_channel = "8453955143+4742004941+7038906246+2072086804+3312032078"; google_ui_features = "rc:6"; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>

微软发布了ASP.NET MVC源代码

微软在CodePlex上建立了一个项目以便和社区分享ASP.NET未来版本的源代码。目前用户已经可以下载到ASP.NET MVC第二个预览版的源代码了。  上周Scott Guthrie宣布微软已经在...
  • aiguanyin
  • aiguanyin
  • 2008-04-12 22:34:00
  • 498

参加北京Scott Guthrie见面会的心得体会[附图]!

这次Scott Guthrie见面会议与Scott个人的介绍:http://blog.csdn.net/dotfun/archive/2008/01/14/2042985.aspx会议大概内容与心得体...
  • dotfun
  • dotfun
  • 2008-01-14 11:53:00
  • 1315

Scott Guthrie 的博客 (英文)

 Scott 是 Microsoft Client and Web Platform & Tools 组的总经理,管理着负责构建 ASP.NET、Atlas、IIS、Visual Web Develo...
  • laoyii
  • laoyii
  • 2007-07-06 02:18:00
  • 478

1小时内打造你自己的PHP MVC框架

这是一篇非常精简的文章去介绍如何去建立一个微型PHP MVC框架,希望可以阐释清楚MVC框架中的一些关键概念。...
  • u012543061
  • u012543061
  • 2016-07-18 16:24:14
  • 2359

ASP.NET MVC 框架

【原文地址】ASP.NET MVC Framework 【原文发表日期】 Sunday, October 14, 2007 10:41 PM 过去的几年里,很多人要求ASP.NET的一件事情就是对使用...
  • DL88250
  • DL88250
  • 2007-10-16 19:05:00
  • 7080

asp.net MVC 项目 框架搭建

1、建立好如上图所示的类库和MVC项目   添加相应的引用,创建EF实体模型 2、定义数据操作基类接口 (具备基本的增、删、改、查、分页方法) namespace Core.ProjectOA.I...
  • zy0421911
  • zy0421911
  • 2016-04-21 00:35:04
  • 2443

MVC模式与ASP.NET MVC框架概述源码

  • 2009年12月30日 21:59
  • 273KB
  • 下载

ASP.NET MVC3 Razor语法简介

Introducing “Razor” – a new view engine for ASP.NET One of the things my team has been working ...
  • shamozhu
  • shamozhu
  • 2011-10-01 17:24:31
  • 3943

MVC5 Entity Framework学习之实现基本的CRUD功能

在上一篇文章中,我们使用Entity Framework 和SQL Server LocalDB创建了一个MVC应用程序,并使用它来存储和显示数据。在这篇文章中,你将对由 MVC框架自动创建的CRUD...
  • zhang957411207
  • zhang957411207
  • 2014-08-23 12:18:41
  • 3448

ASP.NET MVC框架发展历史

  • zhulongxi
  • zhulongxi
  • 2016-11-24 17:12:21
  • 1151
收藏助手
不良信息举报
您举报文章:微软将要推出自己的MVC框架(altnetconf - Scott Guthrie announces ASP.NET MVC framework at Alt.Net Conf)
举报原因:
原因补充:

(最多只允许输入30个字)