T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT...
Transcript of T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT...
![Page 2: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/2.jpg)
ASP.NET MVCA new option for ASP.NETEasily testable and TDD friendly“Closer to the Metal” option
HTTP programming model surfacedMore control over <html/> and URLs
Not for everyone (car vs. motorcycle)
Lots of WebForms improvements coming
![Page 3: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/3.jpg)
GoalsMaintain Clean Separation of Concerns
Enable highly maintainable applications
Enable Easy Unit TestingSupport Red/Green TDD
Extensible and PluggableSupport replacing any component of system
![Page 4: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/4.jpg)
GoalsEnable clean URLs and HTML
SEO and REST friendly URL structures
Great integration within ASP.NETAll the same providers still workMembership, Session, Caching, etc.
![Page 5: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/5.jpg)
Current StatusASP.NET MVC Preview 5 Currently Out
Beta release in a few weeks
Final V1 by end of the year
Production Deployment Supported Now
![Page 6: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/6.jpg)
MVCModel
ControllerView
![Page 7: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/7.jpg)
How ASP.NET MVC WorksBrowser Web
Serverhttp://myserver.com/Products/
ProductsController(Controller)
Product(Model) SQL
Edit.aspx
(View)
http://myserver.com/Products/Edit/5
List.aspx
(View)ViewData
![Page 8: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/8.jpg)
DemoBuilding a Product Catalog
![Page 9: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/9.jpg)
Understanding Form Interactions
ProductsController
(Controller)
GET: /Products/Edit/5
Product(Model) SQL
POST: /Products/Edit/5
URL:
![Page 10: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/10.jpg)
DemoHandling Updates
![Page 11: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/11.jpg)
Filter AttributesEnable custom behavior to be added to Controllers and Controller actionsExamples:
[OutputCache][Authorize][HandleError]
![Page 12: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/12.jpg)
DemoAttributes
![Page 13: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/13.jpg)
Custom URL RoutingCan setup custom URL routing rules within the RegisterRoutes() method in Global.asaxEnables very flexible mapping and route rules:
Default parametersConstraintsNamed routesWildcard “catch-all” routes
![Page 14: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/14.jpg)
DemoCustom Routing
![Page 15: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/15.jpg)
AJAX HelpersBuilt-in AJAX helper object within views
Ajax.Form()Ajax.ActionLink()Ajax.RouteLink()
Automatically emit client-side JavaScript
Use ASP.NET AJAX library by defaultPluggable to use jQuery, Prototype, or other AJAX libraries as well
![Page 16: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/16.jpg)
More Extensibility GoodnessCustom Route RulesController FactoriesCustom IController implementationsCustom View Engines
![Page 17: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/17.jpg)
SummaryA new option for ASP.NET.More control over your <html/> and URLsMore easily testable approachNot for everyone – only use it if you want toShipping later this year
![Page 18: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/18.jpg)
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after
the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
![Page 19: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/19.jpg)
Interfaces and TestingMockable Intrinsics
HttpContextBase, HttpResponseBase, HttpRequestBase
Extensibility IControllerIControllerFactoryIRouteHandlerViewEngineBase
![Page 20: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/20.jpg)
Testing Controller ActionsNo requirement to test within ASP.NET runtime.
Can mock parts of runtime you want to fake[TestMethod]public void ShowPostsDisplayPostView() { BlogController controller = new BlogController(…); var result = controller.ShowPost(2) as ViewResult;
Assert.IsNotNull(result); Assert.AreEqual(result.ViewData[“Message”], “Hello”);}
![Page 21: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/21.jpg)
Common QuestionsShould I use WebForms or MVC?Difference between MVC and MVP?Do I have to write <%= %> code in my view?What about AJAX?How fast/scalable is it?When will it ship?
![Page 22: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/22.jpg)
Even More Detail – Request Flow• You can futz at each step
in the processRequest
![Page 23: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/23.jpg)
ExtensibilityViewsControllersModelsRoutes
…are all Pluggable
![Page 24: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/24.jpg)
ViewEngineBaseView Engines render outputYou get WebForms by defaultCan implement your own
MVCContrib has ones for Brail, NvelocityNHaml is an interesting one to watch
View Engines can be used toOffer new DSLs to make HTML easierGenerate totally different mime/types
Images, RSS, JSON, XML, OFX, VCards, whatever.
![Page 25: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/25.jpg)
View Engine Base ClassViewEngineBase
public abstract class ViewEngineBase { public abstract void RenderView(ViewContext
viewContext); }
![Page 26: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/26.jpg)
NHaml – Extreme Custom Views<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
AutoEventWireup="true" CodeBehind="List.aspx"
Inherits="MvcApplication5.Views.Products.List" Title="Products" %><asp:Content ContentPlaceHolderID="MainContentPlaceHolder"
runat="server"> <h2><%= ViewData.CategoryName %></h2> <ul> <% foreach (var product in ViewData.Products) { %> <li> <%= product.ProductName %> <div class="editlink"> (<%= Html.ActionLink("Edit", new { Action="Edit",
ID=product.ProductID })%>) </div> </li> <% } %> </ul> <%= Html.ActionLink("Add New Product", new { Action="New" }) %></asp:Content>
![Page 27: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/27.jpg)
NHaml – Extreme Custom Views%h2= ViewData.CategoryName
%ul - foreach (var product in ViewData.Products)
%li = product.ProductName .editlink = Html.ActionLink("Edit", new { Action="Edit", ID=product.ProductID }) = Html.ActionLink("Add New Product", new { Action="New" })
![Page 28: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/28.jpg)
APPENDIXMVC
![Page 29: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/29.jpg)
ControllerBase Controller Class
Basic Functionality most folks will useIController Interface
Ultimate Control for the Control FreakIControllerFactory
For plugging in your own stuff (IOC, etc)
![Page 30: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/30.jpg)
Basic Controller HandlingScenarios, Goals and Design
URLs route to controller “actions”, not pages – mark actions in Controller.Controller executes logic, chooses view.All public methods are accessible
public void ShowPost(int id) { Post p = PostRepository.GetPostById(id); if (p != null) { RenderView("showpost", p); } else { RenderView("nosuchpost", id); }}
![Page 31: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/31.jpg)
Controller Base Classpublic class Controller : IController { … protected virtual void Execute(ControllerContext
controllerContext); protected virtual void HandleUnknownAction(string
actionName); protected virtual bool InvokeAction(string actionName); protected virtual void InvokeActionMethod(MethodInfo
methodInfo); protected virtual bool OnError(string actionName, MethodInfo methodInfo, Exception exception); protected virtual void
OnActionExecuted(FilterExecutedContext filterContext);
protected virtual bool OnActionExecuting(FilterExecutedContext filterContext);
protected virtual void RedirectToAction(object values); protected virtual void RenderView(string viewName, string masterName, object viewData);}
![Page 32: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/32.jpg)
Controller – Regular APIspublic class Controller : IController { … protected virtual void Execute(ControllerContext
controllerContext); protected virtual void HandleUnknownAction(string
actionName); protected virtual bool InvokeAction(string actionName); protected virtual void InvokeActionMethod(MethodInfo
methodInfo); protected virtual bool OnError(string actionName, MethodInfo methodInfo, Exception exception); protected virtual void
OnActionExecuted(FilterExecutedContext filterContext);
protected virtual bool OnActionExecuting(FilterExecutedContext filterContext); protected virtual void RedirectToAction(object values);
protected virtual void RenderView(string viewName, string masterName, object viewData);}
![Page 33: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/33.jpg)
Controller – Customization APIspublic class Controller : IController { … protected virtual void Execute(ControllerContext
controllerContext); protected virtual void HandleUnknownAction(string
actionName); protected virtual bool InvokeAction(string actionName); protected virtual void InvokeActionMethod(MethodInfo
methodInfo); protected virtual bool OnError(string actionName, MethodInfo methodInfo, Exception exception); protected virtual void
OnActionExecuted(FilterExecutedContext filterContext);
protected virtual bool OnActionExecuting(FilterExecutedContext filterContext);
protected virtual void RedirectToAction(object values); protected virtual void RenderView(string viewName, string masterName, object viewData);}
![Page 34: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/34.jpg)
Controller – Test Hooks public class Controller : IController { … protected virtual void Execute(ControllerContext
controllerContext); protected virtual void HandleUnknownAction(string
actionName); protected virtual bool InvokeAction(string actionName); protected virtual void InvokeActionMethod(MethodInfo
methodInfo); protected virtual bool OnError(string actionName, MethodInfo methodInfo, Exception exception); protected virtual void
OnActionExecuted(FilterExecutedContext filterContext);
protected virtual bool OnActionExecuting(FilterExecutedContext filterContext);
protected virtual void RedirectToAction(object values); protected virtual void RenderView(string viewName, string masterName, object viewData);}
![Page 35: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/35.jpg)
Basic ViewsScenarios, Goals and Design:
Are for rendering/output. Pre-defined and extensible rendering helpers
Can use .ASPX, .ASCX, .MASTER, etc.Can replace with other view technologies:
Template engines (NVelocity, Brail, …).Output formats (images, RSS, JSON, …).Mock out for testing.
Controller sets data on the ViewLoosely typed or strongly typed data
![Page 36: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/36.jpg)
ViewEngineBaseView Engines render outputYou get WebForms by defaultCan implement your own
MVCContrib has ones for Brail, NvelocityNHaml is an interesting one to watch
View Engines can be used toOffer new DSLs to make HTML easier to writeGenerate totally different mime/types
ImagesRSS, JSON, XML, OFX, etc.VCards, whatever.
![Page 37: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/37.jpg)
View Engine Base ClassViewEngineBase
public abstract class ViewEngineBase { public abstract void RenderView(ViewContext
viewContext); }
![Page 38: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/38.jpg)
NHaml – Extreme Custom Views<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
AutoEventWireup="true" CodeBehind="List.aspx"
Inherits="MvcApplication5.Views.Products.List" Title="Products" %><asp:Content ContentPlaceHolderID="MainContentPlaceHolder"
runat="server"> <h2><%= ViewData.CategoryName %></h2> <ul> <% foreach (var product in ViewData.Products) { %> <li> <%= product.ProductName %> <div class="editlink"> (<%= Html.ActionLink("Edit", new { Action="Edit",
ID=product.ProductID })%>) </div> </li> <% } %> </ul> <%= Html.ActionLink("Add New Product", new { Action="New" }) %></asp:Content>
![Page 39: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/39.jpg)
NHaml – Extreme Custom Views%h2= ViewData.CategoryName
%ul - foreach (var product in ViewData.Products)
%li = product.ProductName .editlink = Html.ActionLink("Edit", new { Action="Edit", ID=product.ProductID }) = Html.ActionLink("Add New Product", new { Action="New" })
![Page 40: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/40.jpg)
Controller FactoryScenarios, Goals and Design:
Hook creation of controller instanceDependency Injection.Object Interception.
public interface IControllerFactory { IController CreateController(RequestContext context, string controllerName);}
protected void Application_Start(object s, EventArgs e) { ControllerBuilder.Current.SetControllerFactory( typeof(MyControllerFactory));}
![Page 41: T22 The ASP.NET MVC Framework - …download.microsoft.com/documents/uk/remix08/day2/01_… · PPT file · Web viewTemplate design: Artitudes Design, Eva Ungvari Formatting: Event](https://reader035.fdocuments.in/reader035/viewer/2022081605/5ac64ebb7f8b9a220b8dd367/html5/thumbnails/41.jpg)
View EngineScenarios, Goals and Design:
Mock out views for testingReplace ASPX with other technologies
public interface IViewEngine { void RenderView(ViewContext context); }
Inside controller class: this.ViewEngine = new XmlViewEngine(...);
RenderView("foo", myData);