Wednesday, December 12, 2007

ASP.NET MVC Framework

ASP.NET MVC Framework:

Over the years ASP.NET does not have built-in support for developing web applications using a model-view-controller (MVC) based architecture. Microsoft is working towards implementing such framework and will be releasing a public preview of this ASP.NET MVC Framework a little later this year. A fully supported ASP.NET feature in the first half of next year.

Before we proceed further, access the link to know what is MVC.

This is true that the as of now ASP.Net does not having the built-in support for MVC framework. However it is possible to achieve the MVC Framework as below.

· Model: - This section is represented by Data view, Dataset, Typed Dataset, Business components, business entity models etc.

· View: - ASPX, ASCX, or windows application UI like data grid etc. form the view part of it.

· Controller: - In ASP.NET the behind code is the controller. As the events are handled by that part. Controller communicates both with Model as well as view.

But the new built-in-support implements the MVC in slightly a new way and provides more flexibility and loose coupling b/w Model, View & Controller.

A few quick details to share in the meantime about the ASP.NET MVC framework:

  • Enables clean separation of concerns, testability, and TDD by default - All core contracts within the MVC framework are interface based and easily mockable (it includes interface based IHttpRequest/IHttpResponse intrinsics). You can unit test the application without having to run the Controllers within an ASP.NET process (making unit testing fast). You can use any unit testing framework you want to-do this testing (including NUnit, MBUnit, MS Test, etc).
  • Highly extensible and pluggable - Everything in the MVC framework is designed so that it can be easily replaced/customized (for example: you can optionally plug-in your own view engine, routing policy, parameter serialization, etc). It also supports using existing dependency injection and IOC container models (Windsor, Spring.Net, NHibernate, etc).
  • Powerful URL mapping - It includes a very powerful URL mapping component that enables you to build applications with clean URLs. URLs do not need to have extensions within them, and are designed to easily support SEO and REST-friendly naming patterns. For example, I could easily map the /products/edit/4 URL to the "Edit" action of the ProductsController class in my project above, or map the /Blogs/scottgu/10-10-2007/SomeTopic/ URL to a "DisplayPost" action of a BlogEngineController class.
  • Compatabilty with Existing:
    • The MVC framework supports using the existing ASP.NET .ASPX, .ASCX, and .Master markup files as "view templates".
    • It does not, however, use the existing post-back model for interactions back to the server. Instead, you'll route all end-user interactions to a Controller class instead - which helps ensure clean separation of concerns and testability (it also means no viewstate or page lifecycle with MVC based views).
    • Fully supports existing ASP.NET features like forms/windows authentication, URL authorization, membership/roles, output and data caching, session/profile state management, health monitoring, configuration system, the provider architecture, etc.

Thanks & Regards,

Arun Manglick || Tech Lead

No comments:

Post a Comment