This document provides an overview of ASP.NET MVC and the MVC pattern. It discusses the objectives of understanding MVC, the major concepts including the model, view and controller. It also covers ASP.NET MVC RC1 and how controllers and views work, and concludes that ASP.NET MVC provides testable applications with clear separation of concerns.
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
ASP.NET MVC RC1 - Understand MVC Pattern, Concepts & Scuba Dive ASP.NET MVC
1.
2. WUX201 - ASP.NET MVC
ASP.NET MVC RC1
Bruno Tavares
Software Engineer @Sapo.pt
3. Objectives
• A session for developers
• Understating the MVC Pattern
• Understating the major concepts
• Scuba Diving on ASP.NET MVC
• Figure out scenarios where it can add value
4. Sometimes…
Editing/developing applications stuff makes me feel like I'm
playing “Operation” with my daughter:
- It’s very tempting and easy to
blend concerns…
It’s hard to keep it simple any
Clean…
5. MVC Pattern
• MVC - Model/View/Controller
• MVC is a architectural pattern
Model
for Presentation Layer
• Isolates business logic from
user interface
• Clean Separation of Concerns
View Controller
• Highly maintainable
applications
6. Model
MVC Pattern
Business Entities
What is the Model?
Workflow
• Responsible for data access, data
persistence, data processing, Processing Data
business rules, etc.
• Agnostic of data presentation Access
• Responds to controller requests and
notifies views that depend of some
model
Database
Webservice
7. MVC Pattern
What is the View? View
Model
• Responsible for presentation,
look and feel, formatting, sorting,
Display(HTML,
etc. Render JSON, XML,
etc)
• A Model can have multiple views
Format
UI Logic
8. What is the Controller? Event
What is the Controller?
Controller
• Responsible for handling events, View1
Select
View2
manipulate the model and select the Select
Select View3
view;
Select View
• Purpose is to receive a event and
figure out what to do with it;
Handling event
Manipulate
Model Model Model
9. What’s ASP.NET MVC RC1?
• Is the first Release Candidate (RC1)
• A new Web Project Type for ASP.NET
• Gives guidance for structuring web apps
• Convention over Configuration
• Delivers RESTfull webapplications/websites
• Extensible and Pluggable – replace any component of the
Framework
• Is fully testable (built with TDD in mind)
• More control over your <html/>
11. Where’s ASP.NET going?
• ASP.NET MVC is just an option built over ASP.NET!
– System.Web;
– System.Web.MVC;
12. Choosing Between MVC and WebForms
ASP.NET Webforms:
• Web Forms is a well-understood technology
• Easy to get start
• Higher abstraction over HTML
• There are many applications where Web Forms work very well
– Typical intranet database reporting app
– Corporate web applications that all the focus is functionality with constraints like
time-to-market
– Web Application where presentation components have a lot of dependencies
between witch others – vast marketplace of controls many of witch are extremely
sophisticated
– Backoffices
13. Choosing Between MVC and WebForms
ASP.NET MVC:
• For those who like to get dirty over HTML
• Lower level or even no abstraction over HTML
• Multiple views over the same data (Model)
• For websites and web applications that you need to have full control
over the output
• Use cases examples:
– Blogs engines
– E-commerce store-front
– Vertical front-channels
14. Choosing Between MVC and WebForms
More control over details
MVC
WebForms ASP.NET
• Do it yourself
• Control ecosystem • Services
• Separation of concerns
• State management
management • Caching
• Test Driven Development
• Faster starting point - • Routing
• Extensibility everywhere
drag and drop • Localization
Ready-to-
Ready-to-use building blocks
15. How it works in ASP.NET?
Request
HTTP
Route View Response
Routing
View
Controller
Engine
21. What's Next in MVC?
• Enterprise scaling features
– More control over session state
– Asynchronous controller actions
• Lambda-based helpers
22. Conclusion
• Fine-grained control over HTML
• It’s extensible and pluggable – add or change for what
you like
• Clear separation of concerns
• Testability - support for Test-Driven Development
• ASP.NET MVC is an OPTION over ASP.NET webforms
25. Software em versão completa para avaliação
Suporte técnico 24x7 para incidentes
Acesso antecipado às versões beta
Microsoft Office
Software Assurance
formação gratuita ….e muito mais.
w w w. m i c r o s o f t . c o m / p o r t u g a l / m s d n / s u b s c r i c o e s
26. w w w. m i c r o s o f t . c o m / l e a r n i n g / m c p / o f f e r s / s e c o n d s h o t
27. MSDN Flash
w w w. m i c r o s o f t . c o m / p o r t u g a l / m s d n / m s d n f l a s h
28. Participe nos próximos ciclos
Traga Amigos a assistir e …
…ganhe uma Xbox, trolleys e
livros
w w w. m i c r o s o f t . c o m / p o r t u g a l / m s d n / w e b c a s t s 4 s h a r e