SlideShare a Scribd company logo
ASP.NET MVC (model-view-controller) Maarten Balliauw – RealDolmen http://blog.maartenballiauw.be
Who am I? Maarten Balliauw Antwerp, Belgium www.realdolmen.com Focus on web ASP.NET, ASP.NET MVC, PHP, Azure, VSTS, … http://blog.maartenballiauw.be http://twitter.com/maartenballiauw
Agenda Overview of ASP.NET ASP.NET MVC Building an application Unit testing Should I choose Webforms or MVC? Q&A
ASP.NET… “ one web application framework to rule them all” Always seen as one whole… ASP.NET Caching Modules Handlers Intrinsics Pages Controls Globalization Profile Master Pages Membership Roles Etc.
Look at it differently! Core infrastructure Different presentation options Presentation Runtime ASP.NET Dynamic Data ASP.NET WebForms ASP.NET MVC ASP.NET Core
ASP.NET MVC A new  presentation option  for ASP.NET Simpler  way to program ASP.NET Easily  testable  and TDD friendly More control  over your <html/> More control over your URLs Not for everyone! (car vs. motorcycle) Not a replacement  for webforms! Supports existing ASP.NET features
Things you will lose… Viewstate Postbacks Tricky interview questions about nuances of the page lifecycle  
MVC? Model-View-Controller! Separation of concerns! Controller (Input) Model (Logic) View (Presentation)
What does an MVC request look like? Controller Handles input (HTTP requests) View Visually represents the model ViewData Request View Controller Response
DEMO File > New…
Framework Goals Easy and frictionless  testability Full control  over your <html/> Full control  over your URLs Leverage  existing ASP.NET features Conventions  and guidance …
Clean URLs Would you use: /Products.aspx?CategoryID={3F2504E0-4F89-11D3-9A0C-0305E82C3301} Or: /Products/Books My Favorite
Extensibility These come into play… …  and are all replacable! Controller Builder Controller Factory Controller View Engine View Controller Action Invoker Action Result Action Filters Model  Binders
DEMO Building an ASP.NET MVC application
Testing Has anyone tried testing webforms? Without IIS being fired up? Each component tested individually? Did you require vacation afterwards?
Infrastructure designed for testing These are all easily mockable! HttpContextBase, HttpResponseBase, HttpRequestBase Extensibility  IController IControllerFactory IRouteHandler IViewEngine, IView
Testing controller actions No requirement to test within ASP.NET runtime! Can mock parts of runtime you want to fake Using Moq, Rhino, TypeMock, … http://code.google.com/p/moq/ [TestMethod] public void ShowPostsDisplayPostView()  { BlogController controller = new BlogController(…); var result = controller.ShowPost(2) as ViewResult; Assert.IsNotNull(result); Assert.AreEqual(result.ViewData[ &quot; Message &quot; ],  &quot; Hello &quot; ); }
Testing controller actions using Moq More on Mocking? Visit VISUG on May 7, 2009 – www.visug.be) [TestMethod] public void TestInvalidCredentials() { LoginController controller = new LoginController(); var mock = new Mock<System.Web.Security.MembershipProvider>(); mock.Expect(m => m.ValidateUser(&quot;&quot;, &quot;&quot;)).Returns(false); controller.MembershipProviderInstance = mock.Object; var result = controller.Authenticate(&quot;&quot;, &quot;&quot;) as ViewResult; Assert.IsNotNull(result); Assert.AreEqual(result.ViewName, &quot;Index&quot;); Assert.AreEqual(controller.ViewData[&quot;ErrorMessage&quot;], &quot;Invalid credentials! Please verify your username and password.&quot;); }
Testing frameworks Any framework is supported! Visual Studio Test NUnit XUnit MBUnit …
DEMO Unit testing
Choosing between Webforms and MVC ASP.NET Webforms Winforms-alike event model Familiar controls Familiar = rapid application development Functionality per page Uses viewstate for state management Less control over rendered HTML ASP.NET MVC Less complex: separation of concerns Easier parallel development TDD support No viewstate, … Full control over behavior and HTML Makes you think
So what do I choose? Go with the flow! Remember: mixing of worlds is possible! Mixing with ASP.NET Webforms Mixing with dynamic data …
Takeaways A new option for ASP.NET Not a replacement for Webforms! More control over your <html/> and URLs Strong, frictionless testability
Resources “ ASP.NET MVC 1.0 Quickly” http://tinyurl.com/mvcquickly My blog http://blog.maartenballiauw.be/category/MVC.aspx   Microsoft http://www.asp.net/mvc http://wiki.asp.net/page.aspx/286/aspnet-mvc-framework/ http://blog.wekeroad.com/blog/i-spose-ill-just-say-it-you-should-learn-mvc/   Community projects http://mvccontrib.codeplex.com http://mvcsitemap.codeplex.com
Questions and Answers http://blog.maartenballiauw.be [email_address]
© 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.
Ad

Recommended

ASP .net MVC
ASP .net MVC
Divya Sharma
 
ASP.NET MVC Presentation
ASP.NET MVC Presentation
Volkan Uzun
 
MVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
Asp.net MVC training session
Asp.net MVC training session
Hrichi Mohamed
 
ASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
 
Why MVC?
Why MVC?
Wayne Tun Myint
 
MVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros Developer
Nyros Technologies
 
Model view controller (mvc)
Model view controller (mvc)
M Ahsan Khan
 
ASP.NET - Life cycle of asp
ASP.NET - Life cycle of asp
priya Nithya
 
An Overview of Web Services: SOAP and REST
An Overview of Web Services: SOAP and REST
Ram Awadh Prasad, PMP
 
Introduction to mvc architecture
Introduction to mvc architecture
ravindraquicsolv
 
Asp.net.
Asp.net.
Naveen Sihag
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web Application
Rishi Kothari
 
Asp Architecture
Asp Architecture
Om Vikram Thapa
 
Design Pattern - MVC, MVP and MVVM
Design Pattern - MVC, MVP and MVVM
Mudasir Qazi
 
ASP.NET Web form
ASP.NET Web form
Md. Mahedee Hasan
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with Overview
Shahed Chowdhuri
 
Introduction to asp.net
Introduction to asp.net
shan km
 
1-01: Introduction To Web Development
1-01: Introduction To Web Development
apnwebdev
 
Html 5 New Features
Html 5 New Features
Ata Ebrahimi
 
Introduction to ReactJS
Introduction to ReactJS
Hoang Long
 
ASP.NET Presentation
ASP.NET Presentation
dimuthu22
 
Angular Introduction By Surekha Gadkari
Angular Introduction By Surekha Gadkari
Surekha Gadkari
 
An Introduction to Semantic Web Technology
An Introduction to Semantic Web Technology
Ankur Biswas
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Edureka!
 
Chapter1 introduction to asp.net
Chapter1 introduction to asp.net
mentorrbuddy
 
Asp.net architecture
Asp.net architecture
Iblesoft
 
Introduction to HTML5
Introduction to HTML5
Gil Fink
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Khaled Musaied
 
Model View Controller (MVC)
Model View Controller (MVC)
Javier Antonio Humarán Peñuñuri
 

More Related Content

What's hot (20)

ASP.NET - Life cycle of asp
ASP.NET - Life cycle of asp
priya Nithya
 
An Overview of Web Services: SOAP and REST
An Overview of Web Services: SOAP and REST
Ram Awadh Prasad, PMP
 
Introduction to mvc architecture
Introduction to mvc architecture
ravindraquicsolv
 
Asp.net.
Asp.net.
Naveen Sihag
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web Application
Rishi Kothari
 
Asp Architecture
Asp Architecture
Om Vikram Thapa
 
Design Pattern - MVC, MVP and MVVM
Design Pattern - MVC, MVP and MVVM
Mudasir Qazi
 
ASP.NET Web form
ASP.NET Web form
Md. Mahedee Hasan
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with Overview
Shahed Chowdhuri
 
Introduction to asp.net
Introduction to asp.net
shan km
 
1-01: Introduction To Web Development
1-01: Introduction To Web Development
apnwebdev
 
Html 5 New Features
Html 5 New Features
Ata Ebrahimi
 
Introduction to ReactJS
Introduction to ReactJS
Hoang Long
 
ASP.NET Presentation
ASP.NET Presentation
dimuthu22
 
Angular Introduction By Surekha Gadkari
Angular Introduction By Surekha Gadkari
Surekha Gadkari
 
An Introduction to Semantic Web Technology
An Introduction to Semantic Web Technology
Ankur Biswas
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Edureka!
 
Chapter1 introduction to asp.net
Chapter1 introduction to asp.net
mentorrbuddy
 
Asp.net architecture
Asp.net architecture
Iblesoft
 
Introduction to HTML5
Introduction to HTML5
Gil Fink
 
ASP.NET - Life cycle of asp
ASP.NET - Life cycle of asp
priya Nithya
 
An Overview of Web Services: SOAP and REST
An Overview of Web Services: SOAP and REST
Ram Awadh Prasad, PMP
 
Introduction to mvc architecture
Introduction to mvc architecture
ravindraquicsolv
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web Application
Rishi Kothari
 
Design Pattern - MVC, MVP and MVVM
Design Pattern - MVC, MVP and MVVM
Mudasir Qazi
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with Overview
Shahed Chowdhuri
 
Introduction to asp.net
Introduction to asp.net
shan km
 
1-01: Introduction To Web Development
1-01: Introduction To Web Development
apnwebdev
 
Html 5 New Features
Html 5 New Features
Ata Ebrahimi
 
Introduction to ReactJS
Introduction to ReactJS
Hoang Long
 
ASP.NET Presentation
ASP.NET Presentation
dimuthu22
 
Angular Introduction By Surekha Gadkari
Angular Introduction By Surekha Gadkari
Surekha Gadkari
 
An Introduction to Semantic Web Technology
An Introduction to Semantic Web Technology
Ankur Biswas
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Edureka!
 
Chapter1 introduction to asp.net
Chapter1 introduction to asp.net
mentorrbuddy
 
Asp.net architecture
Asp.net architecture
Iblesoft
 
Introduction to HTML5
Introduction to HTML5
Gil Fink
 

Viewers also liked (20)

Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Khaled Musaied
 
Model View Controller (MVC)
Model View Controller (MVC)
Javier Antonio Humarán Peñuñuri
 
ASP.NET MVC for Begineers
ASP.NET MVC for Begineers
Shravan Kumar Kasagoni
 
Asp.Net MVC 5
Asp.Net MVC 5
Emanuele Bartolesi
 
Mvc architecture
Mvc architecture
Surbhi Panhalkar
 
ASP.NET MVC Wisdom
ASP.NET MVC Wisdom
Maarten Balliauw
 
Mocking - Visug session
Mocking - Visug session
Maarten Balliauw
 
AZUG.BE - Azure User Group Belgium - First public meeting
AZUG.BE - Azure User Group Belgium - First public meeting
Maarten Balliauw
 
PHP And Silverlight - DevDays session
PHP And Silverlight - DevDays session
Maarten Balliauw
 
MSDN - Converting an existing ASP.NET application to Windows Azure
MSDN - Converting an existing ASP.NET application to Windows Azure
Maarten Balliauw
 
Just another Wordpress weblog, but more cloudy
Just another Wordpress weblog, but more cloudy
Maarten Balliauw
 
PHPExcel
PHPExcel
Maarten Balliauw
 
Final Year Asp.Net Projects, Final Year Vb.Net Projects, Final Year C# Projec...
Final Year Asp.Net Projects, Final Year Vb.Net Projects, Final Year C# Projec...
ncct
 
Intro to asp.net mvc 4 with visual studio
Intro to asp.net mvc 4 with visual studio
Organisation for Economic Co-operation & Development
 
ASP.NET MVC V 2.0
ASP.NET MVC V 2.0
BT Akademi
 
Tutorial asp.net
Tutorial asp.net
Vivek K. Singh
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
Thomas Robbins
 
05 gui 07
05 gui 07
Niit Care
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Maarten Balliauw
 
ASP.NET MVC 3
ASP.NET MVC 3
Buu Nguyen
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Khaled Musaied
 
AZUG.BE - Azure User Group Belgium - First public meeting
AZUG.BE - Azure User Group Belgium - First public meeting
Maarten Balliauw
 
PHP And Silverlight - DevDays session
PHP And Silverlight - DevDays session
Maarten Balliauw
 
MSDN - Converting an existing ASP.NET application to Windows Azure
MSDN - Converting an existing ASP.NET application to Windows Azure
Maarten Balliauw
 
Just another Wordpress weblog, but more cloudy
Just another Wordpress weblog, but more cloudy
Maarten Balliauw
 
Final Year Asp.Net Projects, Final Year Vb.Net Projects, Final Year C# Projec...
Final Year Asp.Net Projects, Final Year Vb.Net Projects, Final Year C# Projec...
ncct
 
ASP.NET MVC V 2.0
ASP.NET MVC V 2.0
BT Akademi
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
Thomas Robbins
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Maarten Balliauw
 
Ad

Similar to MSDN - ASP.NET MVC (20)

ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam
 
ASP.NET Presentation
ASP.NET Presentation
Rasel Khan
 
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe
 
Introduction To Mvc
Introduction To Mvc
Volkan Uzun
 
MVC architecture
MVC architecture
baabtra.com - No. 1 supplier of quality freshers
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVC
Barry Gervin
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
Shiju Varghese
 
Asp.net,mvc
Asp.net,mvc
Prashant Kumar
 
Hanselman lipton asp_connections_ams304_mvc
Hanselman lipton asp_connections_ams304_mvc
denemedeniz
 
MVC Framework
MVC Framework
Ashton Feller
 
Intro ASP MVC
Intro ASP MVC
KrishnaPPatel
 
Technoligent providing custom ASP.NET MVC development services
Technoligent providing custom ASP.NET MVC development services
Aaron Jacobson
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Mayank Srivastava
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVC
Sagar Kamate
 
MVC 4
MVC 4
Vasilios Kuznos
 
ASP.NET MVC 2.0
ASP.NET MVC 2.0
Buu Nguyen
 
A report on mvc using the information
A report on mvc using the information
Toushik Paul
 
ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)
Hatem Hamad
 
Aspnetmvc 1
Aspnetmvc 1
Fajar Baskoro
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvc
Fajar Baskoro
 
ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam
 
ASP.NET Presentation
ASP.NET Presentation
Rasel Khan
 
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe
 
Introduction To Mvc
Introduction To Mvc
Volkan Uzun
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVC
Barry Gervin
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
Shiju Varghese
 
Hanselman lipton asp_connections_ams304_mvc
Hanselman lipton asp_connections_ams304_mvc
denemedeniz
 
Technoligent providing custom ASP.NET MVC development services
Technoligent providing custom ASP.NET MVC development services
Aaron Jacobson
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVC
Sagar Kamate
 
ASP.NET MVC 2.0
ASP.NET MVC 2.0
Buu Nguyen
 
A report on mvc using the information
A report on mvc using the information
Toushik Paul
 
ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)
Hatem Hamad
 
Ad

More from Maarten Balliauw (20)

Bringing nullability into existing code - dammit is not the answer.pptx
Bringing nullability into existing code - dammit is not the answer.pptx
Maarten Balliauw
 
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Maarten Balliauw
 
Building a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to Space
Maarten Balliauw
 
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Maarten Balliauw
 
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...
Maarten Balliauw
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
Maarten Balliauw
 
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
Maarten Balliauw
 
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...
Maarten Balliauw
 
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...
Maarten Balliauw
 
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and Search
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and Search
Maarten Balliauw
 
Approaches for application request throttling - Cloud Developer Days Poland
Approaches for application request throttling - Cloud Developer Days Poland
Maarten Balliauw
 
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...
Maarten Balliauw
 
Approaches for application request throttling - dotNetCologne
Approaches for application request throttling - dotNetCologne
Maarten Balliauw
 
CodeStock - Exploring .NET memory management - a trip down memory lane
CodeStock - Exploring .NET memory management - a trip down memory lane
Maarten Balliauw
 
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
Maarten Balliauw
 
ConFoo Montreal - Approaches for application request throttling
ConFoo Montreal - Approaches for application request throttling
Maarten Balliauw
 
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Maarten Balliauw
 
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
Maarten Balliauw
 
DotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NET
Maarten Balliauw
 
VISUG - Approaches for application request throttling
VISUG - Approaches for application request throttling
Maarten Balliauw
 
Bringing nullability into existing code - dammit is not the answer.pptx
Bringing nullability into existing code - dammit is not the answer.pptx
Maarten Balliauw
 
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Maarten Balliauw
 
Building a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to Space
Maarten Balliauw
 
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Maarten Balliauw
 
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...
Maarten Balliauw
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
Maarten Balliauw
 
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
Maarten Balliauw
 
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...
Maarten Balliauw
 
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...
Maarten Balliauw
 
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and Search
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and Search
Maarten Balliauw
 
Approaches for application request throttling - Cloud Developer Days Poland
Approaches for application request throttling - Cloud Developer Days Poland
Maarten Balliauw
 
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...
Maarten Balliauw
 
Approaches for application request throttling - dotNetCologne
Approaches for application request throttling - dotNetCologne
Maarten Balliauw
 
CodeStock - Exploring .NET memory management - a trip down memory lane
CodeStock - Exploring .NET memory management - a trip down memory lane
Maarten Balliauw
 
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
Maarten Balliauw
 
ConFoo Montreal - Approaches for application request throttling
ConFoo Montreal - Approaches for application request throttling
Maarten Balliauw
 
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Maarten Balliauw
 
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
Maarten Balliauw
 
DotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NET
Maarten Balliauw
 
VISUG - Approaches for application request throttling
VISUG - Approaches for application request throttling
Maarten Balliauw
 

Recently uploaded (20)

" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
Daily Lesson Log MATATAG ICT TEchnology 8
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
"Scaling in space and time with Temporal", Andriy Lupa.pdf
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
Mastering AI Workflows with FME by Mark Döring
Mastering AI Workflows with FME by Mark Döring
Safe Software
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
Safe Software
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
Daily Lesson Log MATATAG ICT TEchnology 8
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
"Scaling in space and time with Temporal", Andriy Lupa.pdf
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
Mastering AI Workflows with FME by Mark Döring
Mastering AI Workflows with FME by Mark Döring
Safe Software
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
Safe Software
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 

MSDN - ASP.NET MVC

  • 1. ASP.NET MVC (model-view-controller) Maarten Balliauw – RealDolmen http://blog.maartenballiauw.be
  • 2. Who am I? Maarten Balliauw Antwerp, Belgium www.realdolmen.com Focus on web ASP.NET, ASP.NET MVC, PHP, Azure, VSTS, … http://blog.maartenballiauw.be http://twitter.com/maartenballiauw
  • 3. Agenda Overview of ASP.NET ASP.NET MVC Building an application Unit testing Should I choose Webforms or MVC? Q&A
  • 4. ASP.NET… “ one web application framework to rule them all” Always seen as one whole… ASP.NET Caching Modules Handlers Intrinsics Pages Controls Globalization Profile Master Pages Membership Roles Etc.
  • 5. Look at it differently! Core infrastructure Different presentation options Presentation Runtime ASP.NET Dynamic Data ASP.NET WebForms ASP.NET MVC ASP.NET Core
  • 6. ASP.NET MVC A new presentation option for ASP.NET Simpler way to program ASP.NET Easily testable and TDD friendly More control over your <html/> More control over your URLs Not for everyone! (car vs. motorcycle) Not a replacement for webforms! Supports existing ASP.NET features
  • 7. Things you will lose… Viewstate Postbacks Tricky interview questions about nuances of the page lifecycle 
  • 8. MVC? Model-View-Controller! Separation of concerns! Controller (Input) Model (Logic) View (Presentation)
  • 9. What does an MVC request look like? Controller Handles input (HTTP requests) View Visually represents the model ViewData Request View Controller Response
  • 10. DEMO File > New…
  • 11. Framework Goals Easy and frictionless testability Full control over your <html/> Full control over your URLs Leverage existing ASP.NET features Conventions and guidance …
  • 12. Clean URLs Would you use: /Products.aspx?CategoryID={3F2504E0-4F89-11D3-9A0C-0305E82C3301} Or: /Products/Books My Favorite
  • 13. Extensibility These come into play… … and are all replacable! Controller Builder Controller Factory Controller View Engine View Controller Action Invoker Action Result Action Filters Model Binders
  • 14. DEMO Building an ASP.NET MVC application
  • 15. Testing Has anyone tried testing webforms? Without IIS being fired up? Each component tested individually? Did you require vacation afterwards?
  • 16. Infrastructure designed for testing These are all easily mockable! HttpContextBase, HttpResponseBase, HttpRequestBase Extensibility IController IControllerFactory IRouteHandler IViewEngine, IView
  • 17. Testing controller actions No requirement to test within ASP.NET runtime! Can mock parts of runtime you want to fake Using Moq, Rhino, TypeMock, … http://code.google.com/p/moq/ [TestMethod] public void ShowPostsDisplayPostView() { BlogController controller = new BlogController(…); var result = controller.ShowPost(2) as ViewResult; Assert.IsNotNull(result); Assert.AreEqual(result.ViewData[ &quot; Message &quot; ], &quot; Hello &quot; ); }
  • 18. Testing controller actions using Moq More on Mocking? Visit VISUG on May 7, 2009 – www.visug.be) [TestMethod] public void TestInvalidCredentials() { LoginController controller = new LoginController(); var mock = new Mock<System.Web.Security.MembershipProvider>(); mock.Expect(m => m.ValidateUser(&quot;&quot;, &quot;&quot;)).Returns(false); controller.MembershipProviderInstance = mock.Object; var result = controller.Authenticate(&quot;&quot;, &quot;&quot;) as ViewResult; Assert.IsNotNull(result); Assert.AreEqual(result.ViewName, &quot;Index&quot;); Assert.AreEqual(controller.ViewData[&quot;ErrorMessage&quot;], &quot;Invalid credentials! Please verify your username and password.&quot;); }
  • 19. Testing frameworks Any framework is supported! Visual Studio Test NUnit XUnit MBUnit …
  • 21. Choosing between Webforms and MVC ASP.NET Webforms Winforms-alike event model Familiar controls Familiar = rapid application development Functionality per page Uses viewstate for state management Less control over rendered HTML ASP.NET MVC Less complex: separation of concerns Easier parallel development TDD support No viewstate, … Full control over behavior and HTML Makes you think
  • 22. So what do I choose? Go with the flow! Remember: mixing of worlds is possible! Mixing with ASP.NET Webforms Mixing with dynamic data …
  • 23. Takeaways A new option for ASP.NET Not a replacement for Webforms! More control over your <html/> and URLs Strong, frictionless testability
  • 24. Resources “ ASP.NET MVC 1.0 Quickly” http://tinyurl.com/mvcquickly My blog http://blog.maartenballiauw.be/category/MVC.aspx Microsoft http://www.asp.net/mvc http://wiki.asp.net/page.aspx/286/aspnet-mvc-framework/ http://blog.wekeroad.com/blog/i-spose-ill-just-say-it-you-should-learn-mvc/ Community projects http://mvccontrib.codeplex.com http://mvcsitemap.codeplex.com
  • 25. Questions and Answers http://blog.maartenballiauw.be [email_address]
  • 26. © 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.