ASP.NET MVC Introduction MVC, Models, Views, Controllers, ASP.NET SoftUni Team Technical Trainers Software University

Slides:



Advertisements
Similar presentations
Introduction to ASP.NET MVC
Advertisements

{ Model View Controller ASP.NET By Scott Crooks & Maggie Wettergreen.
Fabian Vilers Hands on ASP.NET MVC.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
JavaScript Basics Course Introduction SoftUni Team Technical Trainers Software University
Software Quality Assurance QA Engineering, Testing, Bug Tracking, Test Automation Software University Technical Trainers SoftUni Team.
Introduction to Programming
AngularJS Routing Routes, Route Parameters, Templates, Location, Navigation SoftUni Team Technical Trainers Software University
AngularJS Services Built-in and Custom Services SoftUni Team Technical Trainers Software University
Software University Curriculum, Courses, Exams, Jobs SoftUni Team Technical Trainers Software University
Building Web Sites with ASP.NET MVC Framework Noam King CTO Sela College
Fundamentals SoftUni Welcome to Software University SoftUni Team Technical Trainers Software University
Project Tracking Tools Trello, Asana, Basecamp, GitHub Issue Tracker, TRAC SoftUni Team Technical Trainers Software University
AngularJS Directives Defining Custom Directives SoftUni Team Technical Trainers Software University
Software Testing Lifecycle Exit Criteria Evaluation, Continuous Integration Ivan Yonkov Technical Trainer Software University.
Teamwork and Personal Skills Course Introduction Software University SoftUni Team Technical Trainers.
The Web Architecture and ASP.NET. Slide 2 Review of the Web (1) It began with HTTP and HTML, which delivers static Web pages to browsers which would render.
Fundamentals SoftUni Welcome to Software University SoftUni Team Technical Trainers Software University
Design Patterns: Structural Design Patterns
Course Program, Evaluation, Exams
Composer packages Installing and Using Composer, Packagist, Packaging your code Mario Peshev Technical Trainer Software University
Entity Framework Performance SoftUni Team Technical Trainers Software University
Microsoft Azure SoftUni Team Technical Trainers Software University
Svetlin Nakov Technical Trainer Software University
Build Processes and Continuous Integration Automating Build Processes Software University Technical Trainers SoftUni Team.
Test-Driven Development Learn the "Test First" Approach to Coding SoftUni Team Technical Trainers Software University
JavaScript Basics Course Introduction Svetlin Nakov Technical Trainer Software University
Trainers Team Ivan Yonkov Rated in the top 7% at Stack Overflow
Controllers and Markup Controllers, $scope, Markup, Directives, Expressions, Binding, Filters, Validation SoftUni Team Technical Trainers Software University.
AMD and RequireJS Splitting JavaScript Code into Dependent Modules Software University Technical Trainers SoftUni Team.
Asynchronous Web Services Writing Asynchronous Web Services SoftUni Team Technical Trainers Software University
C# Basics Course Introduction Svetlin Nakov Technical Trainer Software University
Controls, Widgets, Grid…
Jekyll Static Site Generator Template-Based Site Generation Svetlin Nakov Technical Trainer Software University
ASP.NET SignalR SoftUni Team Technical Trainers Software University
ASP.NET MVC Telerik Academy
High-Quality Code: Course Introduction Course Introduction SoftUni Team Technical Trainers Software University
Design Patterns: Structural Design Patterns General and reusable solutions to common problems in software design Software University
Advanced C# Course Introduction SoftUni Team Technical Trainers Software University
Object-Oriented Programming Course Introduction Svetlin Nakov Technical Trainer Software University
JavaScript Applications Course Introduction SoftUni Team Technical Trainers Software University
Mocking with Moq Tools for Easier Unit Testing SoftUni Team Technical Trainers Software University
Mocking Unit Testing Methods with External Dependencies SoftUni Team Technical Trainers Software University
Mocking with Moq Mocking tools for easier unit testing Svetlin Nakov Technical Trainer Software University
JavaScript Tools Tools for Writing / Editing / Debugging JavaScript Code Svetlin Nakov Technical Trainer Software University
Test-Driven Development Learn the "Test First" Approach to Coding Svetlin Nakov Technical Trainer Software University
Programming for Beginners Course Introduction SoftUni Team Technical Trainers Software University
Introduction to ASP.NET development. Background ASP released in 1996 ASP supported for a minimum 10 years from Windows 8 release ASP.Net 1.0 released.
The New Face of ASP.NET ASP.NET MVC, Razor, and jQuery Ido Flatow | Senior Architect | Sela | This session is.
JavaScript Applications Course Introduction SoftUni Team Technical Trainers Software University
Software Technologies Course Overview SoftUni Team Technical Trainers Software University
Programming Fundamentals Course Introduction SoftUni Team Technical Trainers Software University
Doctrine The PHP ORM SoftUni Team Technical Trainers Software University
INTRODUCTION TO MVC BY SUHA MNEIMNEH. WHAT’S THE AGENDA What is MVC? MVC components MVC vs web forms vs ASP.NET vocabulary When to create MVC application.
ASP.NET MVC Course Program, Trainers, Evaluation, Exams, Resources SoftUni Team Technical Trainers Software University
Inheritance Class Hierarchies SoftUni Team Technical Trainers Software University
© Copyright SELA software & Education Labs Ltd Baruch Hirsch St.Bnei Brak Israel
Introduction to ASP.NET MVC [Name] [ Address] [Blog URL]
Stacks and Queues Processing Sequences of Elements SoftUni Team Technical Trainers Software University
Generics SoftUni Team Technical Trainers Software University
C# OOP Advanced Course Introduction SoftUni Team Technical Trainers Software University
High-Quality Programming Code Code Correctness, Readability, Maintainability, Testability, Etc. SoftUni Team Technical Trainers Software University
Introduction to MVC SoftUni Team Introduction to MVC
Deploying Web Application
Introduction to ASP.NET MVC
MVC Architecture, Symfony Framework for PHP Web Apps
ASP.NET MVC Introduction
Extending functionality using Collections
JavaScript Frameworks & AngularJS
Lean .NET stack for building modern web apps
Presentation transcript:

ASP.NET MVC Introduction MVC, Models, Views, Controllers, ASP.NET SoftUni Team Technical Trainers Software University

2 1.The MVC Pattern  Model, View, Controller  The MVC Pattern for Web and Examples 2.ASP.NET MVC  Comparison with ASP.NET  ASP.NET MVC Advantages 3.Creating an ASP.NET MVC Project 4.NuGet Package Management 5.Server Information with Glimpse Table of Contents

The MVC Pattern Model-View-Controller

4  Model-View-Controller ( MVC ) is a software architecture pattern  Originally formulated in the late 1970s by Trygve Reenskaug as part of the Smalltalk  Code reusability and separation of concerns  Originally developed for desktop  Then adapted for internet applications The MVC Pattern

5  Set of classes that describes the data we are working with  Rules for how the data can be changed and manipulated  May contain data validation rules  Often encapsulate data stored in a database  as well as code used to manipulate the data  Most likely a Data Access Layer of some kind  It doesn't have significance in the framework  Apart from giving the data objects Model

6  Defines how the application’s user interface (UI) will be displayed  May support master views (layouts)  May support sub-views (partial views or controls)  Web: Template to dynamically generate HTML View

7  The core MVC component – holds the logic  Process the requests with the help of views and models  A set of classes that handles  Communication from the user  Overall application flow  Application-specific logic  Every controller has one or more "actions" Controller

8  Incoming request is routed to a Controller  For web: HTTP request  Controller processes request and creates a presentation Model  Controller also selects appropriate result (view)  Model is passed to View  View transforms Model into appropriate output format (HTML)  Response is rendered (HTTP response) MVC Steps

9 The MVC Pattern for Web

10  PHP: CakePHP, CodeIgniter, LaravelCakePHPCodeIgniterLaravel  Java: SpringSpring  Perl: Catalyst, Dancer  Python: Django, Flask, GrokDjango  Ruby: Ruby on Rails, Camping, Nitro, SinatraRuby on Rails  JavaScript: AngularJS, JavaScriptMVC, SpineAngularJSJavaScriptMVCSpine  ASP.NET MVC (.NET Framework) ASP.NET MVC MVC Frameworks

ASP.NET MVC

12 ASP.NET Core Presentation Runtime CachingCaching.NET.NET HandlersHandlers RoutesRoutes PagesPagesOWINOWIN GlobalizationGlobalization ProfileProfile Web API IdentityIdentity RolesRoles Etc...Etc... ASP.NET

13  Stable and mature, supported by many third-party controls and tools  Event-driven Web development  Rapid Application Development  Postbacks  ViewState  Less control over the HTML  Hard to test ASP.NET Web Forms

14  Classic ASP introduced in late 1990's  2002 – ASP.NET 1.0 (Web Forms)  2008 – ASP.NET 3.5 (First version of MVC)  Two more versions in next two years  2010 – ASP.NET 4 (VS 2010, MVC 2.0, Razor)  2012 – ASP.NET 4.5 (First version of Web API, VS 2012)  2013 – SignalR  2013 – Visual Studio 2013, One ASP.NET, MVC 5  2015 – ASP.NET vNext, Roslyn, OWIN ASP.NET History

15  ASP.NET MVC 1.0  Released on 13 March 2009  ASP.NET MVC 2.0 (Areas, Async)  Released just one year later, on 10 March 2010  ASP.NET MVC 3.0 (Razor) – 13 January 2011  ASP.NET MVC 4.0 (Web API) – 15 August 2012  ASP.NET MVC 5.0 (Identity) – 17 October 2013  ASP.NET MVC 6.0 – soon enough The ASP.NET MVC History

16  Web Forms  Component-based  ASP.NET MVC  Web Pages  Lightweight framework for dynamic content  WebAPI  Framework for building RESTful Web services  SignalR  Real-time client-server communication One ASP.NET

17  Runs on top of ASP.NET  Not a replacement for Web Forms  Leverages the benefits of ASP.NET  Embraces the Web  SEO-friendly URLs, HTML 5, SPA  Adopt REST concepts  Uses the MVC pattern  Conventions and Guidance  Separation of concerns ASP.NET MVC

18  Tight control over markup  Testable  Loosely coupled and extensible  Convention over configuration  Razor view engine  One of the greatest view engines  With IntelliSense, integrated in Visual Studio  Reuse of current skills (C#, EF, LINQ, JS, etc.)  Application-based (not scripts like PHP) ASP.NET MVC (2)

19  Each component has one responsibility  SRP – Single Responsibility Principle  DRY – Don’t Repeat Yourself  More easily testable  TDD – Test-driven development  Helps with concurrent development  Performing tasks concurrently  One developer works on views  Another works on controllers ASP.NET MVC: Separation of Concerns

20  Replace any component of the system  Interface-based architecture  Almost anything can be replaced or extended  Model binders (request data to CLR objects)  Action/result filters (e.g. OnActionExecuting() )  Custom action result types  View engine (Razor, WebForms, NHaml, Spark)  View helpers (HTML, AJAX, URL, etc.)  Custom data providers (ADO.NET), etc. Extensible

21  REST-like URLs  /products/update  /blog/posts/2013/01/28/mvc-is-cool  Friendlier to humans  /product.aspx?catId=123 becomes /products/chocolate/  Friendlier to web crawlers  Search engine optimization (SEO) Clean URLs

22  ASP.NET MVC, Web API, and Web Pages source code is available in CodePlex   You can vote for new features in ASP.NET UserVoice site   vNext is on GitHub  Community-Based

23 MVC Pattern in ASP.NET MVC

Creating an ASP.NET MVC Project

25  Tools that we need:  IDE: Visual Studio 2015 (2013 is also OK)  Framework:.NET Framework (4.5 is also OK)  Web server: IIS 8.5 (Express)  Data: Microsoft SQL Sever (Express or LocalDB)  Visual Studio installer will install everything we need  studio-vs studio-vs The Tools

26  Technologies that ASP.NET MVC uses  C# (OOP, unit testing, async, etc.)  ASP.NET  HTML(5) and CSS  JavaScript (jQuery, Bootstrap, AngularJS, etc.)  AJAX, Single-page apps  Databases (Microsoft SQL Server)  ORM (Entity Framework and LINQ)  Web and HTTP The Technologies

27 Visual Studio 2015: New Project

28 Default Layout for ASP.NET MVC Apps

29 Internet App Project Files All controllers and actions Web.config – Configuration file Application_Start() – The entry point of the application JavaScript files (jQuery, Modernizr, knockout, etc.) View templates _Layout.cshtml – master page (main template) Static files (CSS, Images, etc.)

Demo: Web Application Making Changes and Debugging

NuGet Package Management

32  Free, open source package management  Makes it easy to install and update open source libraries and tools  Part of Visual Studio 2012/2013/2015  Configurable package sources  Simple as adding a reference  GUI-based package installer  Package manager console NuGet Package Management

33  Nightly builds of ASP.NET MVC are available via a private NuGet feed  In your Package Manager settings add the following package source:  Nightly Builds

Demo: NuGet

Server Information with Glimpse The Open Source Diagnostics Platform of the Web

36  Glimpse shows execution timings, server configuration, request data and more  Showed inside browser (like Firebug)  With no changes to the application code  Supports ASP.NET MVC, WebForms and EF Server Info with Glimpse

37 1.Install NuGet packages:  Glimpse.Mvc5  Glimpse.EF6 2.Run the project 3.Configure it:  Install Glimpse

38  The Trace tab shows any messages during the lifetime of the HTTP request traced to:  System.Diagnostics.Trace or System.Diagnostics.Debug Tracing with Glimpse Trace.TraceInformation("Info example"); Trace.TraceWarning("Warning example"); Debug.WriteLine("Debug example");

Demo: Glimpse

40  Model–view–controller (MVC) is a software architecture pattern  ASP.NET MVC is a great platform for developing Internet applications  Visual Studio is the main development tool for creating ASP.NET MVC applications  Almost everything in ASP.NET MVC is a package  Glimpse is a tool that helps with debugging Summary

? ? ? ? ? ? ? ? ? ASP.NET MVC Introduction

License  This course (slides, examples, labs, videos, homework, etc.) is licensed under the "Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International" licenseCreative Commons Attribution- NonCommercial-ShareAlike 4.0 International 42  Attribution: this work may contain portions from  "Fundamentals of Computer Programming with C#" book by Svetlin Nakov & Co. under CC-BY-SA licenseFundamentals of Computer Programming with C#CC-BY-SA  "Data Structures and Algorithms" course by Telerik Academy under CC-BY-NC-SA licenseData Structures and AlgorithmsCC-BY-NC-SA

Free Software University  Software University Foundation – softuni.orgsoftuni.org  Software University – High-Quality Education, Profession and Job for Software Developers  softuni.bg softuni.bg  Software Facebook  facebook.com/SoftwareUniversity facebook.com/SoftwareUniversity  Software YouTube  youtube.com/SoftwareUniversity youtube.com/SoftwareUniversity  Software University Forums – forum.softuni.bgforum.softuni.bg