1. mvc whats new

Upload: martin-belli

Post on 02-Nov-2015

228 views

Category:

Documents


0 download

DESCRIPTION

Novedades de MVC

TRANSCRIPT

Template Setup Guides & Guidelines

Lagash Systems

1ASP.NET MVC

Lots of New ASP.NET MVC FeaturesOne ASP.NETBundling/Minification SupportRazor EnhancementsDatabase MigrationsWeb APIMobile WebReal Time Communication Asynchronous SupportOne ASP.NET

One ASP.NETASP.NETWebFormsSitesWebPagesSinglePageAppsMVCWebAPISignalRServicesOne ASP.NET

One ASP.NET

One ASP.NET

Moving towards a goal - One ASP.NET

Moving towards a goal - One ASP.NET

Unified DialogScaffolding for everyoneMVC, Web Forms, Web API togetherNew extensible Identity SystemOWIN (Open Web Interface for .NET)

and you already know how to do it!One ASP.NET meansBundling and Minification

Bundling and MinificationImprove loading performance of JavaScript and CSSReduce # and size of HTTP requests

Works by convention (no configuration required)

Fully customizable and extensible

MICROSOFT CONFIDENTIAL INTERNAL ONLYBundling and Minification

MICROSOFT CONFIDENTIAL INTERNAL ONLYBundling & Minificationdemo Razor Enhancements

URL Resolution EnhancementsRazor now resolves ~/ within all standard HTML attributes

Today you write:

Razor now allows you to just write:

Conditional Attribute EnhancementsToday you write:

@{ string myClass = null; if (someCondition) { myClass = shinyFancy; }}

ContentConditional Attribute EnhancementsNow you can write:

Will automatically omit attribute name if value is null@{ string myClass = null; if (someCondition) { myClass = shinyFancy; }}

ContentDatabase Migrations

Database MigrationsEF is a powerful O/RM for .NET

EF Code First provides a convention-over-configuration based development approach

Migrations == code-oriented approach to evolve DB schemaCode focusedDeveloper friendlyCan be used to generate SQL change scripts to pass off to a DBA

Web API

Web API Growth

Source: www.programmableweb.com current APIs: 4535+ 100%+ 50%+ 3400%+ 235%+ 71%+ 86%+ 46%+ 63%+ 16%23Mtodos HTTP

Mobile Web

Mobile Web Development A SpectrumMostlyDesktopMostlyMobile26 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.Mobile Web with ASP.NET MVC 4Adaptive RenderingUse of CSS Media Queries within default project templates

Display ModesSelectively adapt views based on devices

Mobile Optimized TemplatesjQuery MobileMobile Webdemo Real Time Communication with SignalRClient to Server persistent connection over HTTPEasily build multi-user, real-time web applicationsAllows server-to-client push and RPCBuilt async to scale to 000s of connections

Auto-negotiates transport:WebSockets (ASP.NET 4.5 on Windows 8)Server Sent Events (EventSource)Forever FrameAjax Long Polling

Open Source on GitHub (https://github.com/signalr/)Chat with SignalR HubsClient JavaScriptServer - .NETvar hub = $.connection.chat;

hub.addMessage = function (msg) { $("#msgs").append("" + msg + "");};

$.connection.hub.start().done(function() { $("#send").click(function() { hub.sendMessage($("#msg").text()); });});

public class Chat : Hub{ public void SendMessage(string message) { Clients.addMessage(message); }}Asynchronous Support

Asynchronous SupportWhy use async on a server?Enables more efficient use of threads and server resources

How does it work?Your controller class yields to ASP.NET when calling a remote resource, allowing the server thread to be re-used while you waitWhen remote call returns, controller is re-scheduled to completeReduces # of threads running -> increases scalability

Use of async on server is not exposed to browsers/clientshttp://myserver.com/products -> same URL can be implemented in ASP.NET using either a synchronous or async controllerMICROSOFT CONFIDENTIAL INTERNAL ONLYAsync in MVC Todaypublic class Products : AsyncController {

public void IndexAsync() {

WebClient wc1 = new WebClient();

AsyncManager.OutstandingOperations.Increment();

wc1.DownloadStringCompleted += (sender, e) => { AsyncManager.Parameters[result"] = e.Result; AsyncManager.OutstandingOperations.Decrement(); };

wc1.DownloadStringAsync(new Uri("http://www.bing.com/")); } public ActionResult IndexCompleted(string result) { return View(); }}33 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.Async in MVC with VS 11public class Products : Controller {

public async Task IndexAsync() {

WebClient web = new WebClient();

string result = await web.DownloadStringAsync("www.bing.com/"); return View(); }}34 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.Asynchronous Supportdemo Preguntas?Work Time

11/29/2013 4:56 AM 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

37Muchas Gracias11/29/2013 4:56 AM38 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.