24
Introduction to ASP.NET MVC @SirwanAfifi

Introduction to ASP.NET MVC

Embed Size (px)

DESCRIPTION

Introduction to ASP.NET MVC

Citation preview

Page 1: Introduction to ASP.NET MVC

Introduction to ASP.NET MVC

@SirwanAfifi

Page 2: Introduction to ASP.NET MVC

What is ASP.NET MVC?

Web Development Framework

The Most Up-to-date Ideas and Techniques from Agile Development

The Best Part of ASP.NET Platform

It is a complete alternative to traditional ASP.NET Web Forms

Page 3: Introduction to ASP.NET MVC

Understanding the History of ASP.NET

.NETA multi-language managed code platform

(brand new at the time – a landmark in its own right)

ASP.NETA way to host .NET applications in IIS, letting you

interactWith HTTP requests and responses

ASP.NET Web FormsA set of UI components (pages, buttons, etc.)

Pulse a stateful, object-oriented GUIProgramming model

Page 4: Introduction to ASP.NET MVC

• ASP.NET 1.0 was first released in 2002 (it was same thing with Webform)

• ASP.NET 2.0 was released in 2005 along with Visual Studio 2005

• ASP.NET MVC was announced in 2007

• ASP.NET 3.5 followed in 2008 and brought with it DynamicData, which enables you to

rapidly generate data-driven applications in minutes.

• ASP.NET 4 was released along with VS2010. At the same time ASP.NET MVC 4 was released

• ASP.NET 4.5 was released along with VS2012 in 2012. This release included ASP.NET MVC 4.5

• ASP.NET 4.5.1 was released along with VS2013. MVC 5.0

• ASP.NET 4.5.2 Update 1,2 VS 2013 (MVC 5.1)

Page 5: Introduction to ASP.NET MVC

ASP.NET Web Forms

Page 6: Introduction to ASP.NET MVC

What Is Wrong with ASP.NET Web Forms ?

Viewstate weight

Page life cycle

False sense of separation of concerns (SOC)

Limited control over HTML

Leaky abstraction

Low testability

Page 7: Introduction to ASP.NET MVC

MVC

Page 8: Introduction to ASP.NET MVC

MVC (cont.)

Model = HTML View= CSS Controller= Browser

Page 9: Introduction to ASP.NET MVC

ASP.NET MVC

ASP.NET MVC is a framework for building web applications that

applies the general ModelView Controller pattern to the ASP.NET framework

Page 10: Introduction to ASP.NET MVC

How ASP.NET MVC Fits in with ASP.NET?

Page 11: Introduction to ASP.NET MVC

• ASP.NET MVC 1 Overview : at the Austin ALT.NET conference in October 2007 in Redmond ScottGu

showed a group of developers “this cool thing I wrote on a plane”- codenamed (Scalene)

• including code and unit tests

• Was released in March 2009

• ASP.NET MVC 2 Overview : was released just one year later, in March 2010

• UI helpers with automatic scaffolding with customizable templates

• Attribute-based model validation on both client and server

• Strongly typed HTML helpers

• Improved Visual Studio tooling

• ASP.NET MVC 3 Overview : shipped just 10 months after MVC 2

• The Razor view engine

• Support for .NET 4 Data Annotations

• Improved model validation

• Better JavaScript support with unobtrusive JavaScript, jQuery Validation, and JSON binding

• Use of NuGet to deliver software and manage dependencies throughout the platform

Page 12: Introduction to ASP.NET MVC

• Razor View Engine

Razor is the first major update to rendering HTML since ASP.NET 1 shipped almost a decade ago.

The default view engine used in MVC 1 and 2 was commonly called the Web Forms view engine

syntax in a Web Forms page is shown here :

Page 13: Introduction to ASP.NET MVC

Razor was designed specifically as a view engine syntax. It has one main focus: code-focused templatingfor HTML generation. Here’s how that same markup would be generated using Razor:

ASP.NET MVC 3.0 Features

Page 14: Introduction to ASP.NET MVC

The Razor syntax is easier to type, and easier to read. Razor doesn’t have the XML-like heavy syntax

of the Web Forms view engine.

• Compact, expressive, and fluid

• Not a new language : Razor is a syntax that lets you use your existing .NET coding skills in a

template in a very intuitive way.

• Easy to learn: Precisely because Razor is not a new language, it’s easy to learn. You know

HTML, you know .NET; just type HTML and hit the @ sign whenever you need to write

some .NET code.

• Good IntelliSense

ASP.NET MVC 3.0 Features (cont.)

Page 15: Introduction to ASP.NET MVC

• Validation Improvements

Validation is an important part of building web applications, but it’s never fun. MVC 3 extended the

validation support to cover most scenarios you’re likely to encounter.

• .NET 4 Data Annotation Support :

• Unobtrusive JavaScript using data- instead of something like onclick,…

• jQuery Validation

• JSON Binding : enabling your action methods to accept and model-bind data in JSON format.

• Dependency Resolution : MVC 3 introduced a new concept called a dependency resolver, which greatly

simplified the use of dependency injection in your applications.

ASP.NET MVC 3.0 Features (cont.)

Page 16: Introduction to ASP.NET MVC

• MVC 4 Overview

• ASP.NET Web API : ASP.NET MVC development style but is tailored to writing HTTP services

• Enhancements to default project templates

• Mobile project template using jQuery Mobile

• Display Modes

• Task support for Asynchronous Controllers

• Bundling and minification

ASP.NET MVC 4

Page 17: Introduction to ASP.NET MVC

• Enhancements to Default Project Templates

MVC 1.0 MVC 4.0

ASP.NET MVC 4 (cont.)

Page 18: Introduction to ASP.NET MVC

• Mobile Project Template Using jQuery Mobile

Responsive jQuery Mobile

ASP.NET MVC 4 (cont.)

Page 19: Introduction to ASP.NET MVC

• Display Modes

Display modes use a convention-based approach to allow selecting different views based on the

browser making the request.

The default view engine first looks for views with names ending with .Mobile.cshtml when the

browser’s user agent indicates a known mobile device.

ASP.NET MVC 4 (cont.)

Page 20: Introduction to ASP.NET MVC

• Bundling and Minification

This system reduces requests to your site by combining several individual script references into a single

request.

ASP.NET MVC 4 (cont.)

Page 21: Introduction to ASP.NET MVC

Open Source Release

Page 22: Introduction to ASP.NET MVC

• MVC 5 Overview

• One ASP.NET

• ASP.Net Identity

• Bootstrap 3.0 in the MVC template

• Authentication Filters

• Filter overrides

• Attribute routing (my Article here)

ASP.NET MVC 5

Page 23: Introduction to ASP.NET MVC

• Includes new cloud-optimized versions of MVC, Web API, Web Pages, SignalR, and

Entity Framework.

• MVC, Web API, and Web Pages will be merged into one framework, called MVC 6

• MVC 6 has no dependency on System.Web

• vNext uses the Rosyln compiler to compile code dynamically

• vNext is open source and cross platform

• vNext is host agnostic

A sneak peak or preview of ASP.NET vNext

Page 24: Introduction to ASP.NET MVC

Question?