The MVC (Model View Controller)Programming Model
MVC stands for Model, View and Controller. these are three components seprate application in MVC (Model , view and controller).
Here we will explain model, view and controller.
i) Model- Model represents the application core (for instance a list of database records),shape of the data and business logic. It maintains the data of the application. Model objects retrieve and store model state in a database.Model is a data and business logic that is called model.
ii)View-view represents the application to displays the data (the database records) and View is a user interface. View display data using model to the user and also enables them to modify the data.
iii)Controller -Controller responsible to controlled the user request. Basically user interact with View, which in-tern keep appropriate URL request, its request will be handled by a controller. The controller renders the appropriate view with the model data as a response that is called controller and also The Controller handles the input (to the database records).
The list of ASP.NET MVC Briefly Explain and growing version :-
The list of ASP.NET MVC Briefly Explain and growing version :-
MVC Version
|
Visual Studio
|
.Net Version
|
Features
|
MVC 1.0
|
VS2008
|
.Net 3.5
|
|
MVC 2.0
|
VS 2008,
|
.Net 3.5/4.0
|
|
MVC 3.0
|
VS 2010
|
.Net 4.0
|
|
MVC 4.0
|
VS 2010 SP1,
VS 2012 |
.NET 4.0/4.5
|
|
MVC 5.0
|
VS 2013
|
.NET 4.5
|
|
MVC 5.2 -
Current
|
VS 2013
|
.NET 4.5
|
|
Advantage of using ASP.NET MVC
·
It
is making very easy to complexity by dividing an application into the model,
the view, and the controller.
·
ASP.Net
MVC through to Enables full control over the rendered HTML and provides a clean
separation of concerns.
·
Finally
use control over HTML also means better permission for implementing compliance
with evolving Web standards in ASP.Net MVC.
·
Full
support adding more interactivity and responsiveness to existing application.
Here is briefly explain how to work life cycle feature ..
Routing: Routing is first process in MVC request cycle. Actually it is system that matches the request's URL with the registered URL pattern in the route table. As soon as matching pattern found in the route table, the routing engine immediately request to the corresponding IRouteHandler in repeat of request, the default being the MVChandler. It suppose the pattern is not found in the route table then the routing engine send a 404 HTTP code in respect of that request.
Secondly when the request application start at first time it send some pattern to the route table to tell the routing system the access to be takes with any request where match these pattern. It has only one route table and this is setup in the Global.asax file of the project application.
Secondly when the request application start at first time it send some pattern to the route table to tell the routing system the access to be takes with any request where match these pattern. It has only one route table and this is setup in the Global.asax file of the project application.
Syntax:-
Public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource} .axd/{*pathinfo}");
routes.Maproute("Default" , //Route Name
"{Controller}/{action}/{id}", URL with parameter
new { controller = "Home", action = "Index" id=UrlParameter.optional } // Parameter defaults
);
}
MVC Handler: Now let's discuss above MVC handler. As we all know MVCHandler is responsible for initiating the actual processing within ASP.Net MVC . It is implement IHttpHandler interface and other processes the request as follows.
Syntax:-
Protected internal virtual void processRequest(HttpcontexBase httpcontex)
{
SecurityUtil.ProcessInApplicationTrust(delegate{ InController controller;
InControllerFactory Factory;
this.ProcessRequestInit(httpContext, out Controller, out factory);
try
{
controller.Executive(this.RequestContext);
}
finally
{
factory.ReleaseController(controller);
}
});
}
Action Execution:- When The controller is initiate into action its ActionInvoker determines the specific action to be invoked and then the action to be execute is chosen based where ActionNameSelectorAttribute (by default, it has in case than the same name as the action chosen) or ActionMethodSelectorAttribute (in case there is move than one method found and the correct one is chosen with the help of attribute) that is called action execute in MVC .
Syntax:-
Public interface IActionInvoker()
{
bool InvokeAction(ControllerContext controllerContext string actionName)
}
View Result:-
Syntax:-
Protected internal virtual void processRequest(HttpcontexBase httpcontex)
{
SecurityUtil.ProcessInApplicationTrust(delegate{ InController controller;
InControllerFactory Factory;
this.ProcessRequestInit(httpContext, out Controller, out factory);
try
{
controller.Executive(this.RequestContext);
}
finally
{
factory.ReleaseController(controller);
}
});
}
Action Execution:- When The controller is initiate into action its ActionInvoker determines the specific action to be invoked and then the action to be execute is chosen based where ActionNameSelectorAttribute (by default, it has in case than the same name as the action chosen) or ActionMethodSelectorAttribute (in case there is move than one method found and the correct one is chosen with the help of attribute) that is called action execute in MVC .
Syntax:-
Public interface IActionInvoker()
{
bool InvokeAction(ControllerContext controllerContext string actionName)
}
View Result:-


No comments:
Post a Comment