Monday, August 1, 2011

Introduction to MVC


  • Here I am Going to explain the basic information about MVC Architecture.

MVC stands for model-view-controller. MVC is a pattern for developing applications that are well architect ed and easy to maintain. MVC-based applications contain:

  • Controllers: Classes that handle incoming requests to the application, retrieve model data, and then specify view templates that return a response to the client.

  • Models: Classes that represent the data of the application and that use validation logic to enforce business rules for that data.

  • Views: Template files that your application uses to dynamically generate HTML responses.

→ The default method of controller is Index method.

Advantages of an MVC-Based Web Application

The ASP.NET MVC framework offers the following advantages:

  • It makes it easier to manage complexity by dividing an application into the model, the view, and the controller.

  • It does not use view state or server-based forms. This makes the MVC framework ideal for developers who want full control over the behavior of an application.

  • It uses a Front Controller pattern that processes Web application requests through a single controller. This enables you to design an application that supports a rich routing infrastructure. For more information, see Front Controller.

  • It provides better support for test-driven development (TDD).

  • It works well for Web applications that are supported by large teams of developers and for Web designers who need a high degree of control over the application behavior.

Features of the ASP.NET MVC Framework

The ASP.NET MVC framework provides the following features:

  • Separation of application tasks (input logic, business logic, and UI logic), testability, and test-driven development (TDD). All core contracts in the MVC framework are interface-based and can be tested by using mock objects, which are simulated objects that imitate the behavior of actual objects in the application. You can unit-test the application without having to run the controllers in an ASP.NET process, which makes unit testing fast and flexible. You can use any unit-testing framework that is compatible with the .NET Framework.

  • An extensible and pluggable framework. The components of the ASP.NET MVC framework are designed so that they can be easily replaced or customized. You can plug in your own view engine, URL routing policy, action-method parameter serialization, and other components. The ASP.NET MVC framework also supports the use of Dependency Injection (DI) and Inversion of Control (IOC) container models. DI enables you to inject objects into a class, instead of relying on the class to create the object itself. IOC specifies that if an object requires another object, the first objects should get the second object from an outside source such as a configuration file. This makes testing easier.

  • Extensive support for ASP.NET routing, which is a powerful URL-mapping component that lets you build applications that have comprehensible and searchable URLs. URLs do not have to include file-name extensions, and are designed to support URL naming patterns that work well for search engine optimization (SEO) and representational state transfer (REST) addressing.

  • Support for using the markup in existing ASP.NET page (.aspx files), user control (.ascx files), and master page (.master files) markup files as view templates. You can use existing ASP.NET features with the ASP.NET MVC framework, such as nested master pages, in-line expressions (<%= %>), declarative server controls, templates, data-binding, localization, and so on.

  • Support for existing ASP.NET features. ASP.NET MVC lets you use features such as forms authentication and Windows authentication, URL authorization, membership and roles, output and data caching, session and profile state management, health monitoring, the configuration system, and the provider architecture.


0 comments:

Post a Comment