Intro to MVC5

Download Report

Transcript Intro to MVC5

Intro to MVC5
Bryan Soltis
Bit-Wizards - Director of Technology & Research
 What is MVC?
 Model
 View
 Controller
Agenda
 What is new in MVC5?
 Demo
 Why use MVC?
 MVC5 vs Web Forms
 Software development pattern defined in the 1970s
 Makes use of interfaces, abstract classes, virtual methods and
some psuedo-AOP (Aspect-Oriented Programming)
What is MVC5?
 Part of ASP.NET
 Hands-on development experience
 Consists of 3 main interchangeable components: Model, View,
Controller
 Actions handled by Routing Engine
 A model is a C# or VB.NET class
 A model is accessible by both controller and view
Model
 A model can be used to pass data from Controller to view
 A view can use model to display data in page.
 View is an ASPX page without having a code behind file
 All page specific HTML generation and formatting can be done
inside view
View
 Can use Inline code (server tags ) to develop dynamic pages
 A request to view (ASPX page) can be made only from a
controller’s action method
 One ASP.NET
 ASP.NET Identity
What’s new in
MVC5?
 Bootstrap
 Authentication filters
 Filter overrides
 Attribute routing
 Controller is a C# or VB.NET class which inherits
system.mvc.controller
 Controller is a heart of the entire MVC architecture
Controller
 Inside Controller’s class action methods can be implemented
which are responsible for responding to browser OR calling views.
 Controller can access and use model class to pass data to views
 Controller uses ViewData to pass any data to view
Demo
 This is an awesome blank slide the says I’m doing a demo.
 The MVC separation helps you manage complex applications.
 Easy to develop test
 Can leverage multiple views of data
 Well-suited for large development teams
 Working with methods, not files
Why MVC5?
 Multiple views on the same data
 URL are naturally SEO friendly
 Not working with the page lifecycle
 Less letters!
MVC
 Allows for separation of
concerns
MVC vs Web
Forms
Web Forms
 Simpler design
 Well-suited for smaller teams
 Allows fine controller of
generated HTML
 Great support for data-heavy
applications
 Easier to develop unit tests
 Rich control libraries and 3rd
party controls
 No View State
 More control over more
aspects of the application
 Easy to implement SEO URLs
 IDE geared for pattern
 More aspects maintained by
underlying architecture
 Supports state of application
 ASP.NET Intro to MVC5
http://www.asp.net/mvc/tutorials/mvc-5/introduction/gettingstarted
More Info
 Scott Hansalman’s 5 minute intro to MVC
http://www.asp.net/mvc/videos/mvc-2/how-do-i/5-minuteintroduction-to-aspnet-mvc
 Thom Robbin’s Intro to MVC5
http://devnet.kentico.com/articles/getting-started-with-visualstudio-2013-and-asp-net-mvc-5?feed=DevNet-Articles-RSS