Top Banner
ASP.NET MVC 5 COURSE MODULE 1 : OVERVIEW BY SERGEY SELETSKY
20
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Asp.net mvc 5 course   module 1 overview

ASP.NET MVC 5COURSE

MODULE 1 : OVERVIEW

BY SERGEY SELETSKY

Page 2: Asp.net mvc 5 course   module 1 overview

Course overview

Module 1 : Overview

Module 2 : Models

Module 3 : Controllers

Module 4 : Views

Module 5 : Security

Module 6 : Routing

Module 7 : Performance

Module 8 : Testing and Debugging

Module 9 : Web API

Module 10 : Integration

Page 3: Asp.net mvc 5 course   module 1 overview

Agenda

Introduction

Architecture

MVC vs Web Forms

Project structure

Configuration

App show case

Best practices

Home work

Page 4: Asp.net mvc 5 course   module 1 overview

Introduction

ASP.NET MVC framework is a lightweight, highly testable presentation framework that is integrated with existing ASP.NET features.

First version released at 13 March 2009In April 2009, the ASP.NET MVC source code was released

Page 5: Asp.net mvc 5 course   module 1 overview

Introduction

ASP.NET MVC enables a clean separation of concerns and that gives you full control over markup.

TDD-friendlySupport latest web standardsRESTful by default

Page 6: Asp.net mvc 5 course   module 1 overview

Architecture

ASP.NET

WebForms

Sites

WebPages

Single Page Apps

MVC Web APISignalR

Services

ASP.NET Overview

Page 7: Asp.net mvc 5 course   module 1 overview

ArchitectureWhat does MVC look like?

ControllerControllerRetrieves Model“Does Stuff”

ViewViewVisually representsthe model

Request

Response

Model

Page 8: Asp.net mvc 5 course   module 1 overview

MVC vs Web Forms

MVC Web Forms

Stre

ngth

s Full control over HTML Clean HTML Separation of Concerns TDD-friendly Many View Engines RESTful by default Lightweight Simple integration

Designed for RAD Visual Studio Designer Many third-party controls Easy for Win Forms engineers

Page 9: Asp.net mvc 5 course   module 1 overview

MVC vs Web Forms

MVC Web Forms

Wea

knes

ses

Not based on server events Complex for Web Forms Dev's Few third-party libraries No View State

UI linked with logic Difficult to test Large page size View State

Page 10: Asp.net mvc 5 course   module 1 overview

MVC vs Web Forms

MVC Web Forms

Opp

ortu

nitie

s

Allows to use TDD Reusable Better integrability

RAD

Page 11: Asp.net mvc 5 course   module 1 overview

MVC vs Web Forms

MVC Web Forms

Thre

ats Difficult to learn

Slow in developing Difficult to integrate Difficult for UI Developers

Page 12: Asp.net mvc 5 course   module 1 overview

Project structure

By default, MVC projects include the following folders:

•App_Data, store folder for data. This folder has the same role in ASP.NET Web Forms.

•Content, which is the recommended location for static files.

•Controllers, which is the recommended location for controllers.

•Models, which is provided for classes that represent the app.

•Scripts, folder for script files.

•Views, which is the recommended location for views.

Page 13: Asp.net mvc 5 course   module 1 overview

Project structure

Creating first project demo

Page 14: Asp.net mvc 5 course   module 1 overview

Configuration

Routing configuration

public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new {

controller = "Home", action = "Index", id = UrlParameter.Optional }

); } }

Page 15: Asp.net mvc 5 course   module 1 overview

Configuration

Bundling and Minifying configuration

public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/bundles/bootstrap") .Include("~/Scripts/bootstrap.js", "~/Scripts/respond.js"));

bundles.Add(new StyleBundle("~/Content/css") .Include("~/Content/bootstrap.css", "~/Content/site.css")); }@Scripts.Render("~/bundles/bootstrap")

@Styles.Render("~/Content/css")

Page 16: Asp.net mvc 5 course   module 1 overview

Real app showcase

Commercial open source app demo

Page 17: Asp.net mvc 5 course   module 1 overview

Best practices

Keep Controllers Thin

Page 18: Asp.net mvc 5 course   module 1 overview

Home work

Create your own solution

1. Create ASP.NET MVC 5 Project for future sessions2. Create book model with few properties3. Create view for book model4. Create books controller5. Use your book model in books controller6. Implement creating and editing for books

Page 19: Asp.net mvc 5 course   module 1 overview

References

Professional ASP.NET MVC 5By Jon Galloway

Pro ASP.NET MVC 5By Adam Freeman

Programming Microsoft ASP.NET MVC, Third EditionBy Dino Esposito

Page 20: Asp.net mvc 5 course   module 1 overview

THANK YOU

20

Sergey Seletsky

[email protected]://www.linkedin.com/in/sergeyseletsky