Understanding ASP.NET MVC Shravan Kumar Thomson Reuters
Walk Away Knowing Introduction to ASP.NET MVC Digging into ASP.NET MVC What’s new in ASP.NET MVC3?
What is ASP.NET? One web application framework to rule them all… ASP.NET Caching Modules Globalization Pages Controls Master Pages Profile Roles Membership Intrinsics Handlers Etc...
ASP.NET WebForms Presentation ASP.NET CORE Runtime
WebForms is great, But it does have some weaknesses
No real role responsibility… Master Page Control Control UI Presentation Logic Business Logic Data Access Control Control Page Control Control Control Control Who does what? How and when?
Control abstractions can be negative…
It isn’t easy enoughto test UI Logic
How does ASP.NET MVC Differ? A new Web Application Project type Not a replacement for WebForms -Builds on top of ASP.NET Simply an another option
Now ASP.NET ASP.NET WebForms ASP.NET MVC Presentation ASP.NET CORE Runtime
What is MVC? A design pattern Separation of concerns Acronym for Model ● View ● Controller
What is MVC? Controller Request Step 1 Incoming request routed to Controller
What is MVC? Controller Model Step 2 Controller processes request and creates presentation Model
What is MVC? Controller View Step 3 Model is passed to View
What is MVC? Controller View Step 4 View transforms Model into appropriate output format
What is MVC? Controller View Response Step 5 Response is rendered
THE FUN STUFF Show Me Some Code!
Framework Goals Frictionless Testability Tight control over <markup/> User/SEO friendly URLs Leverage the benefits of ASP.NET Conventions and Guidance
Separation of Concerns Each component has one responsibility
SRP – Single Responsibility Principle
DRY – Don’t Repeat Yourself
More easily testable (TDD) Helps with concurrent development
Clean URLs REST-like /products/update /blog/posts/2008/08/12/mvc-is-cool Friendlier to humans /product.aspx?categoryid=123 to become Becomes /products/kittens/ Friendlier to web crawlers Search engine optimization (SEO)
Extensible Replace any component of the system
Very few sealed methods / classes
Plays well with others
DEMO – ASP.NET MVC
What’s New in ASP.NET MVC3?
What’s new in ASP.NET MVC 3?
It’s Question Time!
Be well,and stay in email@example.com://theshravan.net/blogTwitter: techieshravan