Introducing ASP.NET MVC : Introducing ASP.NET MVC Alan Dean, Senior Technologist
Slide2 :
Slide3 :
Slide4 :
MVC consists of three kinds of objects : MVC consists of three kinds of objects
Slide6 :
Slide7 : Controller Model View
Slide8 :
Slide9 :
Slide10 : Controller View Model handleEvent service update getData
Slide11 :
Separation of Concerns (SoC) : Separation of Concerns (SoC)
MVC Web Frameworks : MVC Web Frameworks
.NET MVC Web Frameworks : .NET MVC Web Frameworks
Slide15 :
Demo : Demo Create a new ASP.NET MVC Solution
HTTP Request Flow : HTTP Request Flow HTTP Response GET /Home/Index HTTP/1.1 HTTP Request Route Handler Controller Model View
HTTP Request Flow : HTTP Request Flow public class Global : HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.Add(new Route
{
Url = "[controller]/[action]/[id]",
Defaults = new { action = "Index", id = (string)null },
RouteHandler = typeof(MvcRouteHandler)
});
}
} HTTP Response Route Handler HTTP Request Controller Model View
HTTP Request Flow : HTTP Request Flow public class HomeController : Controller
{
[ControllerAction]
public void Index()
{
CompanyInfo companyInfo = new CompanyInfo();
companyInfo.CompanyName = "Your company name here";
RenderView("Index", companyInfo);
}
} HTTP Response Controller HTTP Request Route Handler Model View
HTTP Request Flow : HTTP Request Flow public class CompanyInfo
{
public string CompanyName { get; set; }
} HTTP Response Model HTTP Request Route Handler Controller View
HTTP Request Flow : HTTP Request Flow public partial class Index : ViewPage
{ } Response View <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs"
Inherits="MvcApplication.Views.Home.Index" %>
<%= this.ViewData.companyName %>
<%= Html.ActionLink(“Homepage", "Index", "Home") %>
Welcome!
HTTP Request Route Handler Controller Model
HTTP Request Flow : HTTP Request Flow HTTP/1.1 200 OK
Content-Type: text/html
Your company name here
Index
Welcome!
HTTP Request Route Handler Controller Model View HTTP Response
Wiki : Wiki A wiki is software that allows users to create, edit, and link web pages easily
Slide24 :
Wiki Database : Wiki Database
Wiki HTTP API : Wiki HTTP API
GET : GET
Slide28 :
Slide29 :
POST : POST
Slide31 :
Slide32 :
Slide33 :
Slide34 :
Slide35 :
PUT : PUT
Slide37 :
DELETE : DELETE
Slide39 :
Slide40 :
Slide41 :
REST: The Web Used Correctly : REST: The Web Used Correctly
REST is an Architectural Style : REST is an Architectural Style
Slide44 :
Deriving REST : Deriving REST
Slide46 :
Uniform Interface : Uniform Interface
Benefits of REST : Benefits of REST
Slide49 :
Slide50 :
Slide51 :
Slide52 :