SlideShare uma empresa Scribd logo
1 de 21
Getting Started with ASP.NET MVC
Housekeeping Stuttering is a communication disorder involving disruptions, or “disfluencies,” in a person’s speech. Across all cultures, roughly 1% of people currently has a stuttering disorder. http://westutter.org/
HattanShobokshi Senior Software Engineer www.hattanshobokshi.com hattan@gmail.com http://speakerrate.com/hattan Who am I?
Goals for this talk  Present an overview of ASP.NET MVC MVC vsWebforms. Why? What is the MVC paradigm? Controllers and Action Methods Views Html Helpers Models Model Binding Routing Best Practices
A new web development framework that allows you to develop web applications on the Microsoft stack using an MVC Architecture. Is NOT a replacement for traditional ASP.NET web forms. Web Forms vs MVC Current Version is MVC3. MVC2 and MVC3 are extension of MVC1. MVC1 and MVC2  - .NET Framework 3.5 & 4.0 MVC3 4.0 ONLY Visual Studio Tooling Support Convention over configuration What is ASP.NET MVC
What is MVC?
Why should I use ASP.NET MVC?  Testability Model Binder is awesome! No Viewstate SEO friendly url’s Complete control over Html output Easier integration with Jquery Better Separation of Concerns
ASP.NET Web Forms Traditional urlhttp://www.yoursite.com/admin/menu.aspx
ASP.NET MVC http://www.yoursite.com/admin/menu Admin is not a folder, but a class called AdminController Menu is not a file, but a Method in the AdminController Class
DEMO
Routing Route engine parses url’s, extracts any data and sends it off to controller Create extremely customizable routes Route table defines routes  in global.asax You do not need to define a route to handle querystring parameters. They are automatically mapped.
Model  The model is the representation of your data. Business Logic
Views No Code behind Action methods by default call views with the same name. (Convention over configuration) Views are not tied to a specific action method or controller. Views should be dumb (shouldn’t contain any application logic, only rendering logic) Views can be strongly typed
Html Helpers Html helpers are extension methods that generate html. @Html.TextBox(“Name”,”Bob”) Html helpers are NOT controls, they simply generate html markup (strings) You can create your own Html Helper.
Model Binding Takes data from an html form and creates an object. No need to write plumbing code
Best Practices Never include a hard reference in the view(eg <script src=“../js/jquery.js”></script>)instead use url.content like so<script src=“<%=Url.Content(“~/js/jquery.js”)%>”></script>) Never have big if then else in view, put it in an html helper Add namespace to web.config so you don’t have to keep referencing it on each page The difference between routing name and class name.
Where can I get it? http://www.asp.net/mvc/download/ http://www.microsoft.com/express/Web/
Resources http://www.asp.net/learn/mvc/ http://www.asp.net/learn/mvc-videos/ Pro ASP.NET MVC Framework by Steven Sanderson Asp.net mvc Forumshttp://forums.asp.net/1146.aspx http://haacked.com/
What did we just talk about?  Present an overview of ASP.NET MVC  MVC vsWebforms. Why? What is the MVC paradigm? Controllers and Action Methods Views Html Helpers Models Model Binding Routing Best Practices
The End Thank you!

Mais conteúdo relacionado

Mais procurados (9)

Joomla Extensions Kung Fu
Joomla Extensions Kung FuJoomla Extensions Kung Fu
Joomla Extensions Kung Fu
 
Get satrted angular js
Get satrted angular jsGet satrted angular js
Get satrted angular js
 
Angular js Classes in Pune
Angular js Classes in PuneAngular js Classes in Pune
Angular js Classes in Pune
 
W3 schools javascript quiz test
W3 schools javascript quiz testW3 schools javascript quiz test
W3 schools javascript quiz test
 
ASP.NET Web Forms vs. MVC
ASP.NET Web Forms vs. MVCASP.NET Web Forms vs. MVC
ASP.NET Web Forms vs. MVC
 
Walther Mvc
Walther MvcWalther Mvc
Walther Mvc
 
Android MVVM
Android MVVMAndroid MVVM
Android MVVM
 
A Good PHP Framework For Beginners Like Me!
A Good PHP Framework For Beginners Like Me!A Good PHP Framework For Beginners Like Me!
A Good PHP Framework For Beginners Like Me!
 
Android MVVM
Android MVVMAndroid MVVM
Android MVVM
 

Destaque (6)

ASP.NET MVC Best Practices malisa ncube
ASP.NET MVC Best Practices   malisa ncubeASP.NET MVC Best Practices   malisa ncube
ASP.NET MVC Best Practices malisa ncube
 
Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
 
Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6
 
ASP.NET MVC Performance
ASP.NET MVC PerformanceASP.NET MVC Performance
ASP.NET MVC Performance
 
Model View Controller (MVC)
Model View Controller (MVC)Model View Controller (MVC)
Model View Controller (MVC)
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 

Semelhante a Getting Started with ASP.NET MVC

Object Oriented Programming with Laravel - Session 3
Object Oriented Programming with Laravel - Session 3Object Oriented Programming with Laravel - Session 3
Object Oriented Programming with Laravel - Session 3
Shahrzad Peyman
 
report_vendor_connect
report_vendor_connectreport_vendor_connect
report_vendor_connect
Yash Mittal
 

Semelhante a Getting Started with ASP.NET MVC (20)

Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
 
MSDN - ASP.NET MVC
MSDN - ASP.NET MVCMSDN - ASP.NET MVC
MSDN - ASP.NET MVC
 
Php and-mvc
Php and-mvcPhp and-mvc
Php and-mvc
 
Which is better asp.net mvc vs asp.net
Which is better  asp.net mvc vs asp.netWhich is better  asp.net mvc vs asp.net
Which is better asp.net mvc vs asp.net
 
Object Oriented Programming with Laravel - Session 3
Object Oriented Programming with Laravel - Session 3Object Oriented Programming with Laravel - Session 3
Object Oriented Programming with Laravel - Session 3
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 
Pcs global (4)
Pcs global (4)Pcs global (4)
Pcs global (4)
 
ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
 
TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0
 
MVC
MVCMVC
MVC
 
MVC From Beginner to Advance in Indian Style by - Indiandotnet
MVC From Beginner to Advance in Indian Style by - IndiandotnetMVC From Beginner to Advance in Indian Style by - Indiandotnet
MVC From Beginner to Advance in Indian Style by - Indiandotnet
 
ASP.net MVC CodeCamp Presentation
ASP.net MVC CodeCamp PresentationASP.net MVC CodeCamp Presentation
ASP.net MVC CodeCamp Presentation
 
Day1
Day1Day1
Day1
 
Worry free web development
Worry free web developmentWorry free web development
Worry free web development
 
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch TutorialMongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introduction
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
 
report_vendor_connect
report_vendor_connectreport_vendor_connect
report_vendor_connect
 
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5  Building Your First Web Application (A Beginner S GuideASP.NET MVC 5  Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
 
Welcome to IE8 - Integrating Your Site With Internet Explorer 8
Welcome to IE8 - Integrating Your Site With Internet Explorer 8Welcome to IE8 - Integrating Your Site With Internet Explorer 8
Welcome to IE8 - Integrating Your Site With Internet Explorer 8
 

Último

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Getting Started with ASP.NET MVC

  • 1. Getting Started with ASP.NET MVC
  • 2. Housekeeping Stuttering is a communication disorder involving disruptions, or “disfluencies,” in a person’s speech. Across all cultures, roughly 1% of people currently has a stuttering disorder. http://westutter.org/
  • 3. HattanShobokshi Senior Software Engineer www.hattanshobokshi.com hattan@gmail.com http://speakerrate.com/hattan Who am I?
  • 4. Goals for this talk Present an overview of ASP.NET MVC MVC vsWebforms. Why? What is the MVC paradigm? Controllers and Action Methods Views Html Helpers Models Model Binding Routing Best Practices
  • 5. A new web development framework that allows you to develop web applications on the Microsoft stack using an MVC Architecture. Is NOT a replacement for traditional ASP.NET web forms. Web Forms vs MVC Current Version is MVC3. MVC2 and MVC3 are extension of MVC1. MVC1 and MVC2 - .NET Framework 3.5 & 4.0 MVC3 4.0 ONLY Visual Studio Tooling Support Convention over configuration What is ASP.NET MVC
  • 7.
  • 8. Why should I use ASP.NET MVC? Testability Model Binder is awesome! No Viewstate SEO friendly url’s Complete control over Html output Easier integration with Jquery Better Separation of Concerns
  • 9. ASP.NET Web Forms Traditional urlhttp://www.yoursite.com/admin/menu.aspx
  • 10. ASP.NET MVC http://www.yoursite.com/admin/menu Admin is not a folder, but a class called AdminController Menu is not a file, but a Method in the AdminController Class
  • 11. DEMO
  • 12. Routing Route engine parses url’s, extracts any data and sends it off to controller Create extremely customizable routes Route table defines routes in global.asax You do not need to define a route to handle querystring parameters. They are automatically mapped.
  • 13. Model The model is the representation of your data. Business Logic
  • 14. Views No Code behind Action methods by default call views with the same name. (Convention over configuration) Views are not tied to a specific action method or controller. Views should be dumb (shouldn’t contain any application logic, only rendering logic) Views can be strongly typed
  • 15. Html Helpers Html helpers are extension methods that generate html. @Html.TextBox(“Name”,”Bob”) Html helpers are NOT controls, they simply generate html markup (strings) You can create your own Html Helper.
  • 16. Model Binding Takes data from an html form and creates an object. No need to write plumbing code
  • 17. Best Practices Never include a hard reference in the view(eg <script src=“../js/jquery.js”></script>)instead use url.content like so<script src=“<%=Url.Content(“~/js/jquery.js”)%>”></script>) Never have big if then else in view, put it in an html helper Add namespace to web.config so you don’t have to keep referencing it on each page The difference between routing name and class name.
  • 18. Where can I get it? http://www.asp.net/mvc/download/ http://www.microsoft.com/express/Web/
  • 19. Resources http://www.asp.net/learn/mvc/ http://www.asp.net/learn/mvc-videos/ Pro ASP.NET MVC Framework by Steven Sanderson Asp.net mvc Forumshttp://forums.asp.net/1146.aspx http://haacked.com/
  • 20. What did we just talk about? Present an overview of ASP.NET MVC MVC vsWebforms. Why? What is the MVC paradigm? Controllers and Action Methods Views Html Helpers Models Model Binding Routing Best Practices

Notas do Editor

  1. Controller gets data from the model, Gives it to a view.Controller doesn’t care where model gets data, and likewise controller doesn’t care how the view renders.Each component only cares about itself. Easy to swap out.Benefits :Separation of ConcernsTestabilityEasy to modifyLack of ComplexityFlow:Request comes through. Controller class handles the request, fetching data from the model. Controller then sends that data to the View and the result is given to the framework for rendering