concept MVC in category c#

This is an excerpt from Manning's book ASP.NET MVC 2 in Action.
ASP.NET MVC is a new web application framework from Microsoft. It was first unveiled in November 2007 and has since seen more than 10 releases and 2 major versions. With the high number of releases, this framework has received quite a bit of feedback and is much more stable than some other new frameworks from Microsoft, such as Windows Workflow Foundation. MVC stands for Model-View-Controller, a pattern that’s becoming increasingly popular with web development frameworks.
ASP.NET MVC is both an alternative and a complement to Web Forms, which means you won’t be dealing with pages and controls, postbacks or view state, or complicated event lifecycles. Instead, you’ll be defining controllers, actions, and views. The underlying ASP.NET platform is the same, however, so things like HTTP handlers and HTTP modules still apply, and you can mix MVC and Web Forms pages in the same application.
There are other types of models. Just as presentation models represent the user interface, domain models typically represent a part of a business or conceptual problem, and we’ll cover the domain model in chapter 8. Armed with knowledge of the M in MVC, you are now ready to move on to chapter 3, where we’ll more closely examine MVC views.

This is an excerpt from Manning's book ASP.NET MVC in Action with MvcContrib, NHibernate, and More.
In this section, we’ll explain what the MVC pattern is and create our first ASP.NET MVC Web Application. We’ll focus first on the controller because in the Model-View-Controller triad, the controller is in charge and decides what model objects to use and what views to render. The controller is in charge of coordination and executes first when the web request comes in to the application. The controller is responsible for deciding what response is appropriate for the request.
The Model-View-Controller pattern is not new. A core tenet of the MVC pattern is to separate control logic from the view, or a screen. A view is only responsible for rendering the user interface. By separating domain logic and decoupling data access and other calls from the view, the UI can stay the same even while logic and data access changes within the application. Figure 1.1 shows a simple diagram of the MVC triad. Note that the controller has a direct relationship with the view and the model, but the model does not need to know about the controller or the view. The web request will be handled by the controller, and the controller will decide which model objects to use and which view objects to render.
Figure 1.1. A simple diagram depicting the relationship between the Model, View, and Controller. The solid lines indicate a direct association, and the dashed lines indicate an indirect association (graphic and description used with permission from Wikipedia).
![]()
To begin, we’ll open up Visual Studio 2008 SP1 and create our project. The edition of Visual Studio 2008 makes a difference. Although there are some workarounds to using the ASP.NET MVC Framework without SP1, System.Web.Abstractions.dll and System.Web.Routing.dll are in the GAC (global assembly cache) as of SP1. You can use Visual Studio 2008 Professional, a Team Edition SKU, or Visual Web Developer Express SP1. Note that the ASP.NET MVC Framework builds on top of Web Application Projects, and although it’s possible to make it work with websites, the development experience is optimized for use with Web Application Projects.
Model-View-Controller as a pattern emerged about 20 years ago in the Smalltalk community. Since then, numerous representations of the MVC pattern for almost every visual technology and language have developed. Combined with object-oriented programming, the MVC pattern provides a powerful separation of concerns between view technologies and the logic to interpret and react to user input. The MVC pattern is certainly not new, nor is ASP.NET MVC the first MVC framework to exist on the ASP.NET platform.
Many alternative MVC frameworks position themselves as full-stack MVC frameworks, where everything from database to deployment to hosting is included in the framework. Full-stack frameworks can greatly reduce the amount of development time needed to create an application, as all components are designed to work together to create one seamless development experience.
In this chapter, we will examine MVC frameworks built for both .NET and other platforms. We will dive into MonoRail, which is a popular MVC framework built on .NET and is part of the larger Castle Project. Next, we will explore another popular web framework, Ruby on Rails. Ruby on Rails is built on the dynamic language of Ruby, and uses the strong opinions of the framework’s developers to guide the end user down well-trodden paths. By the end of this chapter, you will be familiar with two major MVC frameworks used today and their primary features, benefits, and advantages.