MVC Architecture in ASP.Net By Nyros Developer

5,213 views

Published on

MVC Architecture in ASP.Net By Nyros Developer

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,213
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
137
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

MVC Architecture in ASP.Net By Nyros Developer

  1. 2. Agenda <ul><li>What is ASP.NET MVC </li></ul><ul><li>What is MVC </li></ul><ul><li>MVC Flow </li></ul><ul><li>Routing </li></ul><ul><li>Using Ajax & Security </li></ul><ul><li>Choosing Between MVC and Web forms </li></ul><ul><li>Which one is better ? </li></ul><ul><li>Summary </li></ul>
  2. 3. What is ASP.NET MVC? <ul><li>A new Web Application Project type </li></ul><ul><li>Simply an option </li></ul><ul><ul><ul><li>Not a replacement for WebForms </li></ul></ul></ul><ul><ul><ul><li>Builds on top ASP.NET </li></ul></ul></ul><ul><ul><ul><li>Manual vs Automatic Transmission </li></ul></ul></ul>
  3. 4. What is MVC? Model Controller View
  4. 5. Separation Of Concerns <ul><li>Each component has one responsibility </li></ul><ul><ul><li>SRP : Single Responsibility Principle </li></ul></ul><ul><ul><li>More easily testable </li></ul></ul><ul><li>Helps with concurrent development </li></ul>
  5. 6. <ul><li>Not the new Web Forms 4.0 </li></ul><ul><li>Not replacing Web Forms, but Adds to it </li></ul><ul><li>It can not use Web Controls </li></ul><ul><li>Not a whole new engine but sits on ASP.NET engine </li></ul><ul><li>Not the best solution for REST </li></ul>What MVC is not ?
  6. 7. <ul><li>Maintain Clean Separation of Concerns </li></ul><ul><li>Extensible and Pluggable </li></ul><ul><li>Enable clean URLs and HTML </li></ul><ul><li>Great integration within ASP.NET </li></ul><ul><li>Tooling Support </li></ul>
  7. 8. MVC Flow
  8. 11. <ul><li>URLs -> application -> Controller Action </li></ul><ul><li>Construct outgoing URLs </li></ul><ul><ul><li>Constructed URLs can be used to call back to Controllers/Actions </li></ul></ul>Routing Engine
  9. 12. Sequence Diagram ASP.Net MVC Flow
  10. 13. <ul><li>Ajax is not just “Update Panel”  </li></ul><ul><li>You can use </li></ul><ul><ul><li>Page methods </li></ul></ul><ul><ul><li>Web Services </li></ul></ul><ul><li>They all require you to write a lot of javascript </li></ul><ul><li>MVC Ajax helps with Forms and ActionLinks !! </li></ul>Ajax Support
  11. 14. <ul><li>Built in Controller for Logging </li></ul><ul><li>Using ASP.NET Security Providers </li></ul><ul><li>Having the ability to control the security level of each controller method </li></ul>Security Support
  12. 15. Choosing Between WebForms and MVC Now that Asp.Net is much more mainstream at work, The question is asked time and again as to which one should be used while developing a Web Application. One possible way to answer this question is to do a analysis of both the frameworks.
  13. 18. ASP.Net MVC VS Web Forms <ul><li>Uses the ‘Front Controller’ pattern. There is a single central controller for all pages to process web application requests and facilitates a rich routing architecture </li></ul><ul><li>At its core, ASP.NET MVC was designed to make test-driven development easier. You ‘can’ test your Controller without instantiating a View and carry out unit-tests without having to run the controllers in an ASP.NET process. </li></ul><ul><li>Uses the ‘Page Controller’ pattern. Each page has a code-behind class that acts as a controller and is responsible for rendering the layout. </li></ul><ul><li>At its core, you ‘cannot’ test your controller without instantiating a View. There are ways to get around it using tools </li></ul>
  14. 19. ASP.Net MVC VS Web Forms <ul><li>A thorough understanding of how HTML, CSS and JavaScript work together is required. The advantage is you can do a lot of jQuery and AJAX stuff in an efficient and simple manner than you would do in an ASP.NET application. </li></ul><ul><li>You lose the 'drag and drop' quick model of building your web applications. </li></ul><ul><li>Deep understanding of HTML, CSS and JavaScript is not required to a large extent since the WebForm model abstracts a lot of these details and provides automatic plumbing. While abstracting details to provide ease of use, sometimes a solution is overcomplicated, than it needs to be. </li></ul><ul><li>Can drastically reduce time while building up intranet and internet applications that use a lot of controls (drag and drop model). </li></ul>
  15. 20. <ul><li>WebForms ??????? </li></ul><ul><li>MVC ?????? </li></ul>Which one is better ?
  16. 22. Summary Not a replacement for WebForms – All about alternatives Fundamental – Same team that builds WebForms

×