67
Building a Next-Generation Web Application with ASP.NET MVC 2 and jQuery Nate Kohari Co-Founder / CTO Enkari, Ltd. [email protected]

Building a Next-Generation Web Application with ASP.NET MVC 2 and jQuery

  • Upload
    nasnan

  • View
    29

  • Download
    0

Embed Size (px)

DESCRIPTION

Building a Next-Generation Web Application with ASP.NET MVC 2 and jQuery. Nate Kohari Co-Founder / CTO Enkari , Ltd. [email protected]. Who?. Goals. ASP.NET is a great platform for building attractive, standards-compliant rich internet applications. - PowerPoint PPT Presentation

Citation preview

Page 1: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Building a Next-Generation Web Applicationwith ASP.NET MVC 2 and jQuery

Nate KohariCo-Founder / CTOEnkari, [email protected]

Page 2: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Who?

Page 3: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery
Page 4: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery
Page 5: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Goals

Page 6: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

ASP.NET is a great platformfor building attractive, standards-compliant

rich internet applications

Page 7: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

You can build rich internet applications withoutSilverlight or Flash

Page 8: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Why ASP.NET MVC?

Page 9: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

BizSpark

Page 10: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Why jQuery?

Page 11: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

(demo)

Page 12: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

User Action

Metadata Lookup

Route Lookup

Filters

Domain Service

Event Broadcast

Anatomy of a typicalZen request

Page 13: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

User Action

Metadata Lookup

Route Lookup

Filters

Domain Service

Event Broadcast

ASP.NET MVC

HTML/JavaScript

Page 14: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

User Action

Metadata Lookup

Route Lookup

Filters

Domain Service

Event Broadcast

Page 15: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

JS.Class

Page 16: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Zen.Ui.StoryCard = new JS.Class({ func1: function() { ... }, func2: function() { ... }});

var card = new Zen.Ui.StoryCard();

Page 17: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Behaviors

Page 18: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

$(“.story-card”).attach( Zen.Ui.Behaviors.StoryCard);

Page 19: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Find all elements with the CSS class story-card…

$(“.story-card”).attach( Zen.Ui.Behaviors.StoryCard);

Page 20: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

…and apply the appropriate behavior

$(“.story-card”).attach( Zen.Ui.Behaviors.StoryCard);

Page 21: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Which card did theuser move?

Page 22: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

User Action

Metadata Lookup

Route Lookup

Filters

Domain Service

Event Broadcast

Page 23: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

<li data-projectid=“123” data-storyid=“456”> ...</li>

HTML5 data-* attributes

(story card)

Page 24: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

<li data-projectid=“123” data-storyid=“456”> ...</li>

HTML5 data-* attributes

(story card)

{ projectid: 123, storyid: 456 }

JSON read via Metadata Plugin

Page 25: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Where should we sendthe request?

Page 26: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

User Action

Metadata Lookup

Route Lookup

Filters

Domain Service

Event Broadcast

Page 27: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

One Action = One Route

Page 28: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

One Action = One Route(“route-per-action”)

Page 29: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

<app> <project> <route action=“move” pattern=“project/{projectid}/story/{storyid}/move” verbs=“post”/> ... </project> ...</app>

Routes defined in XML:

Page 30: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

<app> <project> <route action=“move” pattern=“project/{projectid}/story/{storyid}/move” verbs=“post”/> ... </project> ...</app>

Routes defined in XML:

…at app start, parsed & registered in RouteTable

Page 31: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

<app> (area) <project> <route action=“move” pattern=“project/{projectid}/story/{storyid}/move” verbs=“post”/> ... </project> ...</app>

Routes defined in XML:

Page 32: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

<app> <project> (controller) <route action=“move” pattern=“project/{projectid}/story/{storyid}/move” verbs=“post”/> ... </project> ...</app>

Routes defined in XML:

Page 33: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

<app> <project> <route action=“move” pattern=“project/{projectid}/story/{storyid}/move” verbs=“post”/> ... </project> ...</app>

Routes defined in XML:

Page 34: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Url.Action(“move”, “story”, new { projectid = 123, storyid = 456 })

Page 35: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Url.Action(“move”, “story”, new { projectid = 123, storyid = 456 })

http://agilezen.com/projects/123/story/456/move

Page 36: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

But wait… we needthe route in JavaScript!

Page 37: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

urlfor()

Page 38: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

urlfor(“move”, “story”, { projectid: 123, storyid: 456 })

Page 39: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

urlfor(“move”, “story”, { projectid: 123, storyid: 456 })

http://agilezen.com/projects/123/story/456/move

Page 40: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

urlfor(“move”, “story”, { projectid: 123, storyid: 456 })

Metadata read from story card <li>

Page 41: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

routes.js

Page 42: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

User Action

Metadata Lookup

Route Lookup

Filters

Domain Service

Event Broadcast

Page 43: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

User Action

Metadata Lookup

Route Lookup

Filters

Domain Service

Event Broadcast

ASP.NET MVC

HTML/JavaScript

Page 44: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Aspect Oriented Programming

Page 45: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

[Demand]

Page 46: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

[Demand(Permission.EditStory)]

Page 47: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

[Secured]

Page 48: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

[Secured(SSLMode.Force)]

Page 49: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

[Transactional]

Page 50: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Output Filters

Page 51: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

[DoNotCache]

Page 52: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

[StripWhitespace]

Page 53: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

[HandleExceptions]

Page 54: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

User Action

Metadata Lookup

Route Lookup

Filters

Domain Service

Event Broadcast

Page 55: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Filters SecurityOther cross-cutting concerns

Page 56: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

ControllerInterprets requestsCommunicates with browserSets up view data

Filters SecurityOther cross-cutting concerns

Page 57: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Controller

Domain Service

Interprets requestsCommunicates with browserSets up view data

Modifies data modelBroadcasts events

Filters SecurityOther cross-cutting concerns

Page 58: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Controller

Domain Service

Repository

Interprets requestsCommunicates with browserSets up view data

Modifies data modelBroadcasts events

Persists data to database

Filters SecurityOther cross-cutting concerns

Page 59: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Controller

Domain Service

Repository

Filters

LINQ

NHibernate

Page 60: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

User Action

Metadata Lookup

Route Lookup

Filters

Domain Service

Event Broadcast

Page 61: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Messenger

SMTP Service

Domain Service

XMPP Service

Page 62: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Messenger

SMTP Service

Domain Service

XMPP Service

Events queued

Page 63: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Messenger

SMTP Service

Domain Service

XMPP Service

Events queued

Page 64: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Messenger

SMTP Service

Domain Service

XMPP Service

Email notifications IM notifications

Events queued

Page 65: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

User Action

Metadata Lookup

Route Lookup

Filters

Domain Service

Event Broadcast

Recap

Page 66: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery
Page 67: Building a Next-Generation Web Application with ASP.NET MVC 2 and  jQuery

Thanks for listening!Nate Koharihttp://kohari.orghttp://[email protected]@nkohari