article

Introduction to MVC

basics of MVC and the moving parts

[WHAT]

  1. ] VIDEO SUMMARY - summary notes on the video, this lesson explains what MVC is, why you should want to use it and then demonstrates how to create an MVC project

[WHY]

  1. ] MVC advantages over msft forms programming paradigm
  2. ] about MVC
  3. ] MVC hello world demo and explaination

[WHERE]

  1. ] WATCH THE FULL VIDEO
    1. ] Microsoft MVC intro - by microsoft's Jon Galloway and Christopher Harrison

[WHEN]

  1. ] 2014-06-24 - produced

[EXAMPLE]

  1. [00:00] introduction
    1. ] intro to is
  2. [04:00] expectations
    1. poll of people who are taking this course,
    2. - 18% new dev
    3. - 10 know html, new to .net
    4. - 12 exp .net , new to web forms
    5. - 30 exp. with forms, new to mvc
    6. - 28 some experience with mvc, want to learn more
    7. - 2 lion tamers
    8. setting expections - trying to connect with people who are 'relatively'new
    9. in particular talking to web forms developers
    10. src code is available on github
    11. up front apology in advance, recorded live
    12. MVA - points
  3. [08:45] Basics of asp.net MVC
    1. diagram [sites + services] at the top, [asp.net] at the bottom, in the middle, ] web pages, ] web forms, ] MVC, ] SPA ] signalR, ] web api ]
    2. MVC is a different coding model
    3. running on top of asp.net
    4. in [web forms, web pages] user request is mapped to a file, file does something and returns html
  4. [c]ontroller
    1. in MVC - request comes into a method in a controller, user is calling a method on a class
    2. little bit of magic in how the requests gets routed into the right class, right method, will look into that later
    3. migrating to good class design VS managing a lot of different files
  5. [m]odel
    1. a lot of time, the result of a controller action is 'data', aka a model, just a class
    2. model is just the data, a collection, an array, a string, /NOT hooked into your database, just the data
    3. dont know where they came from or where they are going
  6. [v]iew
    1. visually represents the model, the views job is to take the model info and turn it into html
    2. seperatation of concerns
    3. no logic - should be in your view, controller should do the
    4. NOT all the code goes in the controller
    5. the MVC flow is NOT your whole application
  7. [19:30][WHY - MVC]
    1. every web app needs structure
    2. mvc helps you stay organized
    3. often less code, not more
    4. smoother learning curve as your project grows
    5. lends itself to writing well structured code much more easily
    6. will typically find yourself with more classes and methods,
    7. more work in starting with MVC, but its worth it
    8. in web form, controls are handling html and css, some issues
    9. - diagram asp.net page life cycle -
    10. - multiple pages within a single page, (master, product, cart)
    11. - each with page life cycle,
    12. - controls work by handling "view state" controls make it seem like persistant state, a lot of steps are being done, that you dont see
    13. - in web forms, you don't have direct control of id's and classes, they can be controlled, you have to go and do them specifically
    14. - MVC doesnt have
  8. - MVC designed for testability
    1. - testing your code in code, a safety net / seat belt
    2. - verify behaviour of your code
    3. - not covered in this course, but really important and you should do it
    4. - point is, MVC is designed to make unit testing easy, test everything in isolation
  9. [34:00] hello world - file new project
    1. point is making it more code focused, not drag and drop, wysiwyg
    2. file | new project | new web application
    3. options ( empty, web forms, MVC, API, SPA, FB, Azure Service )
    4. can include multiple types in the (forms and MVC) in the same application, check the appropriate boxes at the bottom of the dialog
    5. options - start with empty, add in whatever you need
    6. can share services across different types of paradigms,
    7. > CHECKBOX - azure - no demo of deployment today, but can click check box in VS to publish to your azure web site
    8.  free web site and free 20 mb sql server db on msft
    9. > CHECKBOX - add unit tests -
    10. - as app starts, NUGET packages are added, automatically installs dependancies
    11. - MVC support is added as a nuget package
    12. - a lot of good information on the start screen of the demo app
  10. [45:45] understanding an MVC project, the directory structure
  11.  SOLUTION(.sln) - the project name, file used by VS to
    - Properties
    - References
    - /App_Data
    - /App_Start
    - /Content
    - /Controllers - a class, contains methods, inheirits from controller, create action methods, when someone calls into the class, the action method will be the code that is executed
    - /fonts
    - /Models - contains classes for your data
    - /Scripts
    - /Views - contains your view(s), required, framework will look here for view code,
  12. -/Shared - contains files used across multiple , _SiteLayout.cshtml,
    - Global.asax
    - packages.config
    - projectReadMe.html
    - Startup.cs
  13. ] important to understand - conventions that map -
  14. - ex your are in the home controller, your "Index" method says ...
  15. return View();
  16. - this is where "conventions" kick in, b/c you are in Home controller, it looks in views for \Home, then for Index view within that directory, b/c the names match you dont have to specify a view name
  17. - uses bootstrap, automatically scales based upon device type,
  18. [50:00] REVIEW
    1. what is MVC
    2. why you should care
    3. file new project - whats involved in creating a new project
    4. controllers
    5. controllers returning a view
    6. no model data used
    7. next lesson is on controllers

[HOW-TO]

  1. ]

[REFERENCE]

  1. ] # 5359 - overview series ] reference ] to do, ] done

 

quiz

results = 4/5

x] what are the different types of authentication you can use on an MVC project

 

Details Photos Edit more

Details

ID: 4580

NAME: introduction-MVC-lesson-1

DESCRIPTION: [55:00]VIDEO-SUMMARY Introduction to MVC - Lesson 1 - by Jon Galloway and Christopher Harrison of Microsoft

AUTHOR: article.author/s

EDITOR: article.editor/s

PUBLISHER: article.publisher/s

STATUS: Write

PRIORITY: 0

OWNER ID: 75

Content Photos Edit more

photos

page_photo

actions

Email Email-Owner SMS and