asp.net mvc 4

20
ASP.NET MVC 4 Asp.net MVC Consultant Business & Decision HRICHI Mohamed

Upload: hrichi-mohamed

Post on 30-Jun-2015

657 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Asp.net mvc 4

ASP.NET MVC 4 Asp.net

MVC ConsultantBusiness & Decision

HRICHIMohamed

Page 2: Asp.net mvc 4

What Is MVC ?

• Model-View-Controller• A design Pattern (Methodology)• Invented by Smalltalk programmer

(Trygve Reenskaug 1979).• Separation of Concerns / Single

Responsibility Principle• More easily testable

Page 3: Asp.net mvc 4

What Is MVC ?

• ModelDataBusiness rules

• View User interfaceThe representation of Model

• ControllerApplication’s Brain (Handle user requests, bind

Datareturn views)

Page 4: Asp.net mvc 4

Model View Controller Pattern

Page 5: Asp.net mvc 4

Asp.net MVC

• Separation of application tasks (No code Behind)

• An extensible and pluggable framework• Friendly URLs (Routing)• More Control Over HTML (No server side

Controls)• Supports existing ASP.NET features

(Authentication, Membership, roles, output caching,…)

• Easily Testable

Page 6: Asp.net mvc 4

Demo: Asp.net MVC Hello World

Page 7: Asp.net mvc 4

Asp.net MVC 4 Features

• Bundling/Minification• Mobile Template• Web APIs• Asynchronous • Real-time communication

Page 8: Asp.net mvc 4

Bundling and Minification

Improve JavaScript and CSS files loading• Minimize the Number of requests (Bundle in one File)• Reduce the size of files (remove spaces, enters and

comments)

Fully customizable and extensible

Page 9: Asp.net mvc 4

Without Bundling and Minification

Page 10: Asp.net mvc 4

With Bundling and Minification

Page 11: Asp.net mvc 4

Demo: Bundling and Minification

Page 12: Asp.net mvc 4

Mobile Template

Adaptive RenderingUse of CSS Media Queries within default project templates

Display ModesSelectively adapt views based on devices

Mobile Optimized TemplatesjQuery Mobile

Page 13: Asp.net mvc 4

Demo: Mobile Templete

Page 14: Asp.net mvc 4

Web APIsSimple way to expose data and services (RESTful web service)

Reach a broad range of clients (Browsers, Mobile, desktop)

Multiple ways to host and expose Web APIs

Same programming model

Maximum flexibility (Json, XML, …)

Page 15: Asp.net mvc 4

Demo: Web Api

Page 16: Asp.net mvc 4

Asynchronous

Asynchronous action methods for long-running

Calling Web Services Asynchronously

More efficient use of threads and server resources

Page 17: Asp.net mvc 4

Asynchronous

public class Products : Controller {

public async Task<ActionResult> IndexAsync() {

WebClient web = new WebClient();

    string result = await web.DownloadStringAsync("www.bing.com/");     return View(); }}

Page 18: Asp.net mvc 4

Real-time communication (SignalR)• Real-time web functionality (Chat, Games)• Push content to the connected clients• call JavaScript functions in your clients' browsers

from server-side .NET code

Page 19: Asp.net mvc 4

Demo: SignalR

Page 20: Asp.net mvc 4

Questions