ASP.NET MVC 4Danijel MalikArtifis Danijel Malik s.p.Twitter: @DanijelMalikEmail: danijel@artifis.si                       ...
About me•   Developer•   Developer•   Developer•   Tech Lead•   Developer•   Architect…who you? No you’re not!!!•   Develo...
New features•   Bundling/Minification Support•   Database Migrations•   Mobile Web•   Web APIs•   Real Time Communication•...
Bundling and Minification• Improve loading performance of JavaScript and CSS   • Reduce # and size of HTTP requests• Works...
DEMOBundling & minification                          Nivo 300
Razor improvements• Razor now resolves ~/ within all standard HTML attributes• From this:      <script      src=”@Url.Cont...
Conditional Attribute Enhancements• From this:  @{    string myClass = null;      if (someCondition) {          myClass = ...
Conditional Attribute Enhancements• To this:  @{    string myClass = null;      if (someCondition) {          myClass = ”s...
Database Migrations• EF Code First provides a convention-over-configuration based  development approach• Migrations == cod...
DEMODatabase Migrations                      Nivo 300
Mobile Web• Adaptive Rendering   • Use of CSS Media Queries within default project templates• Display Modes   • Selectivel...
Mobile Web Development – ASpectrum       Adaptive   Display    Mobile      Rendering   Modes     Template                 ...
DEMOMobile Web             Nivo 300
DEMOWeb API          Nivo 300
Web API Hosting• Multiple ways to host and expose Web APIs:   • Within ASP.NET applications inside IIS, IIS Express, VS We...
DEMOWeb API hosting                  Nivo 300
Asynchronous Support• Why use async on a server?  • Enables more efficient use of threads and server resources• How does i...
Async in MVC Todaypublic class Products : AsyncController {    public void IndexAsync() {        WebClient wc1 = new WebCl...
Async in MVC with VS 11public class Products : Controller {    public async Task<ActionResult> IndexAsync() {        WebCl...
VPRAŠANJA?Po zaključku predavanja, prosimo, izpolnite vprašalnik.Vprašalniki bodo poslani na vaš e-naslov, dostopni pa bod...
Upcoming SlideShare
Loading in …5
×

ASP.NET MVC 4

2,226 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,226
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
47
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

ASP.NET MVC 4

  1. 1. ASP.NET MVC 4Danijel MalikArtifis Danijel Malik s.p.Twitter: @DanijelMalikEmail: danijel@artifis.si Nivo 300
  2. 2. About me• Developer• Developer• Developer• Tech Lead• Developer• Architect…who you? No you’re not!!!• Developer• Developer• Tech Lead…come on…stop it already…you’re a developer!!!! Nivo 300
  3. 3. 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 Nivo 300
  4. 4. 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 Nivo 300
  5. 5. DEMOBundling & minification Nivo 300
  6. 6. Razor improvements• Razor now resolves ~/ within all standard HTML attributes• From this: <script src=”@Url.Content(“~/Scripts/Site.js”)”></script>• To this: <script src=”~/Scripts/Site.js”></script> @ Nivo 300
  7. 7. Conditional Attribute Enhancements• From this: @{ string myClass = null; if (someCondition) { myClass = ”shinyFancy”; } } <div @{if (myClass != null) { <text>class=”@myClass”</text> } }>Content</div> Nivo 300
  8. 8. Conditional Attribute Enhancements• To this: @{ string myClass = null; if (someCondition) { myClass = ”shinyFancy”; } }• Will automatically omit attribute name if value is null <div class=”@myClass”>Content</div> Nivo 300
  9. 9. 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 Nivo 300
  10. 10. DEMODatabase Migrations Nivo 300
  11. 11. 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 Nivo 300
  12. 12. Mobile Web Development – ASpectrum Adaptive Display Mobile Rendering Modes Template Nivo 300
  13. 13. DEMOMobile Web Nivo 300
  14. 14. DEMOWeb API Nivo 300
  15. 15. 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 Nivo 300
  16. 16. DEMOWeb API hosting Nivo 300
  17. 17. 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 Nivo 300
  18. 18. Async 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(); }} Nivo 300
  19. 19. Async in MVC with VS 11public class Products : Controller { public async Task<ActionResult> IndexAsync() { WebClient web = new WebClient(); string result = awaitweb.DownloadStringAsync("www.bing.com/"); return View(); }} Nivo 300
  20. 20. VPRAŠANJA?Po zaključku predavanja, prosimo, izpolnite vprašalnik.Vprašalniki bodo poslani na vaš e-naslov, dostopni pa bodo tudipreko profila na spletnem portalu konference www.ntk.si.Najlepša hvala! Nivo 300

×