Presentation is loading. Please wait.

Presentation is loading. Please wait.

Virtual techdays INDIA │ 9 th – 11 th January 2011 ASP.Net MVC Sundararajan S │ Associate Tech Architect, Aditi Technologies.

Similar presentations


Presentation on theme: "Virtual techdays INDIA │ 9 th – 11 th January 2011 ASP.Net MVC Sundararajan S │ Associate Tech Architect, Aditi Technologies."— Presentation transcript:

1 virtual techdays INDIA │ 9 th – 11 th January 2011 ASP.Net MVC Sundararajan S │ Associate Tech Architect, Aditi Technologies

2  MVC  ASP.Net MVC  Hybrid Projects in Asp.Net MVC virtual techdays INDIA │ 9 th – 11 th January 2011 S E S S I O N A G E N D A

3 MVC Design pattern Conery, Hanselman, Haack, Guthrie define it as… – An architectural pattern used to separate an application into three main aspects Model. Set of classes that represent data and business rules for how data can be changed and manipulated View. Application’s user interface Controller. Set of classes that handles communication from user, overall application flow, and application-specific logic

4 Web forms issues  Web forms don’t support as precise control over “separation of concerns”  Too much of an application ends up in the “code behind”  High level of abstraction  Not as “close to the metal” as some devs want  Web forms are not as well suited for testing  Testing the “code behind” code is difficult  Search engine optimization (SEO) issues  ASP.NET 4.0 addresses this

5 Model View Controller  Model - Data and Business Rules  View – Presentation layer – Aspx / HTML  Controller – Classes that are responsible for application flow

6 virtual techdays INDIA │ 9-11 Januarty 2011 Demo – Building a Blog engine in Asp.Net MVC Sundararajan S │ Assoc. Tech Architect, Aditi

7 ASP.Net MVC Request Processing Architecture Incoming HTTP Request IIS / ASP.Net URL Routing Module Serve the file directly Matching file on disk RouteTable.Routes IRouteHandler IHttpHandler MVCRouteHandler ControllerFactory IController Custom controller factory ActionMethod Writes directly to http response Return ActionResult Is A ViewResult? Not A ViewResult? ActionResult.Execute Routing Controller/ Actions

8 ASP.Net MVC Request Processing Architecture View Engine WebForm -.Aspx Render View Custom View Engine Views

9 1.Add ref to System.Web.Mvc.dll - need to browse for it under C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 2\Assemblies 2.Add ref to System.Web.Routing 3.Create an Empty MVC Project a)Copy the Controllers, Models and Views directories into the Web Forms application b)Copy the RegisterRoutes method in Global.asax to the Global.asax in the Web Forms project c)Add RegisterRoutes(RouteTable.Routes); to the Application_Start in the Web Forms project d)Add using System.Web.MVC and using System.Web.Routing to Global.asax in the Web Forms project 9 Hybrid Projects

10 4.Add the following to the section of web.config Hybrid projects

11 5.Add the following to the section of web.config >

12 6.Enable MVC Tooling in Web Form Application a)Right-click on project and select unload b)Right-click on project and select Edit.csproj c)In section add at beginning of list of Guids: {F85E285D-A4E0-4152-9332-AB1D724D3325} d)Right-click on project and select reload 7.Close and reopen solution

13 Thank you sundararajans@hotmail.com http://tinyurl.com/codeshelve


Download ppt "Virtual techdays INDIA │ 9 th – 11 th January 2011 ASP.Net MVC Sundararajan S │ Associate Tech Architect, Aditi Technologies."

Similar presentations


Ads by Google