Download presentation
Presentation is loading. Please wait.
Published byAlexander Barker Modified over 8 years ago
1
Nivo 300 ASP.NET MVC 4 Danijel Malik Artifis Danijel Malik s.p. Twitter: @DanijelMalik Email: danijel@artifis.si
2
Nivo 300 Developer Tech Lead Developer Architect…who you? No you’re not!!! Developer Tech Lead…come on…stop it already…you’re a developer!!!! About me
3
Nivo 300 New features Bundling/Minification Support Database Migrations Mobile Web Web APIs Real Time Communication Asynchronous Support Works with VS 2010/.NET 4 and built-into VS11
4
Nivo 300 Bundling and Minification Improve loading performance of JavaScript and CSS Reduce # and size of HTTP requests Works by convention (no configuration required) Fully customizable and extensible
5
Nivo 300 DEMO Bundling & minification
6
Nivo 300 Razor improvements Razor now resolves ~/ within all standard HTML attributes From this: To this: @
7
Nivo 300 Conditional Attribute Enhancements From this: @{ string myClass = null; if (someCondition) { myClass = ”shinyFancy”; } class=”@myClass” } }>Content
8
Nivo 300 Conditional Attribute Enhancements To this: Will automatically omit attribute name if value is null @{ string myClass = null; if (someCondition) { myClass = ”shinyFancy”; } Content
9
Nivo 300 Database Migrations EF Code First provides a convention-over-configuration based development approach Migrations == code-oriented approach to evolve DB schema Code focused Developer friendly Can be used to generate SQL change scripts to pass off to a DBA
10
Nivo 300 DEMO Database Migrations
11
Nivo 300 Mobile Web Adaptive Rendering Use of CSS Media Queries within default project templates Display Modes Selectively adapt views based on devices Mobile Optimized Templates jQuery Mobile
12
Nivo 300 Mobile Web Development – A Spectrum Adaptive Rendering Display Modes Mobile Template
13
Nivo 300 DEMO Mobile Web
14
Nivo 300 DEMO Web API
15
Nivo 300 Web API Hosting Multiple ways to host and expose Web APIs: Within ASP.NET applications inside IIS, IIS Express, VS Web Server Self hosted within any custom app (console, Windows Service, etc) Same programming model Maximum flexibility
16
Nivo 300 DEMO Web API hosting
17
Nivo 300 Asynchronous Support Why 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 wait When remote call returns, controller is re-scheduled to complete Reduces # of threads running -> increases scalability Use of async on server is not exposed to browsers/clients http://myserver.com/products -> same URL can be implemented in ASP.NET using either a synchronous or async controller http://myserver.com/products
18
Nivo 300 Async in MVC Today public 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/"));http://www.bing.com/ } public ActionResult IndexCompleted(string result) { return View(); }
19
Nivo 300 Async in MVC with VS 11 public class Products : Controller { public async Task IndexAsync() { WebClient web = new WebClient(); string result = await web.DownloadStringAsync("www.bing.com/");www.bing.com/ return View(); }
20
Nivo 300 VPRAŠANJA? Po zaključku predavanja, prosimo, izpolnite vprašalnik. Vprašalniki bodo poslani na vaš e-naslov, dostopni pa bodo tudi preko profila na spletnem portalu konference www.ntk.si.www.ntk.si Najlepša hvala!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.