Top Banner
ZZ Bl ack Coffee #8 Hello ASP.NET MVC 4 Chalermpon Areepong Nine (นนน)
20

ZZ BC#8 Hello ASP.NET MVC 4 (dks)

May 10, 2015

Download

Technology

สรุปงาน ZZ BC#8 : Hello ASP.NET MVC 4
https://www.facebook.com/events/366911040032706/
เมื่อวันเสาร์ที่ 2 มิถุนายน 2555

Slide: http://www.slideshare.net/nine69/zz-bc8-hello-aspnet-mvc-4-dks
Demo Code: http://dl.dropbox.com/u/34809954/ZZBC%238HelloMVC4.7z

ตัวอย่าง ZZMVCChat: ใช้ mvc 4 last nightly build version เพราะ RC ไม่มี PushStreamContent class
และหากทดสอบข้ามเครื่องต้องใช้ iis + ip/dns เช่น http://10.10.10.10/zzmvcchat
** window.EventSource เป็น HTML5 feature

แล้วพบกันใหม่ meeting หน้าครับ
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

ZZ Black Coffee #8 Hello ASP.NET MVC 4Chalermpon AreepongNine (นาย)

Page 2: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

About me

0 Chalermpon Areepong0 Microsoft MVP Thailand (ASP.NET)

0 Work for ICBC THAI0 Blog http://nine69.wordpress.com0 User Group https://

www.facebook.com/groups/MVCTHAIDEV

Page 3: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

AGENDA

0 Enhancement to default project template0 New Razor 2.00 Bundling and Minification0 ASP.NET WEB APIs0 Enhanced support for asynchronous methods0 New Mobile Support

Page 4: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

Enhancements to Default Project Templates

0 Design for adaptive rendering to look good in both desktop browsers and mobile browsers without any customization.

Page 5: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

Demo

0 Show new default project template

Page 6: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

New Razor 2.0

0 Razor now supports conditional attributes. In an HTML element

<input type="checkbox“ name="check1" value="check1" checked="@checked1" />

0 Support path “~/” for all HTML attributes

Page 7: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

Demo

0 Razor 2

Page 8: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

Bundling and Minifacation

0 Reduce size of script and css file (remove whitespace)0 New App_Start Folder

0 BundleConfig.cs0 BundleConfig. RegisterBundles()

bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-1.*"));

bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));*changes from Beta

0 Call in [email protected]("~/bundles/jquery")@Styles.Render("~/Content/themes/base/css", "~/Content/css")

Page 9: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

Demo

0 Bundling and Minifacation

Page 10: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

ASP.NET WEB APIs

0 Change name from WCF Web API 0 Easy to build HTTP services0 Support Browsers and Mobile devices0 Build RESTful applications on the .NET Framework

Page 11: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

ASP.NET WEB APIs

Requestjson, xml, form

Device App

Responsejson, xml

Web App

Others HTTP Request

HTTP get, post, etc.

ASP.NETWEB API

Page 12: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

ASP.NET WEB APIs

0 Modern HTTP programming model: Directly access and manipulate HTTP requests and responses in your Web APIs using a new, strongly typed HTTP object model.

0 Full support for routes: 0 Content negotiation: support for XML, JSON, and Form URL-encoded

formats and custom format.0 Model binding and validation: like controller base0 Filters: support filter such as [Authorize]attribute.0 Query composition: Use the [Queryable] filter attribute on an action that

returns IQueryable to enable support for querying your web API via the OData query conventions.

0 Improved Testability: use HttpRequestMessage and HttpResponseMessage to create a unit test project

Page 13: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

ASP.NET WEB APIs0 Code-based configuration: ASP.NET Web API configuration is accomplished

solely through code, leaving your config files clean. Use the provide service locator pattern to configure extensibility points.

0 Improved support for Inversion of Control (IoC) containers: support dependency resolver abstraction

0 Self-host: Web APIs can be hosted in your own process in addition to IIS while still using the full power of routes and other features of Web API.

0 Create custom help and test pages: using the new IApiExplorer service to get a complete runtime description of your web APIs.

0 Monitoring and diagnostics: System.Diagnostics, ETW and third party logging frameworks.

0 Link generation: Use the ASP.NET Web API UrlHelper to generate links to related resources in the same application.

0 Web API project template: new project template 0 Scaffolding: by Add Controller dialog to quickly.

Page 14: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

Demo

0 Basic Web API0 SelfHost ( AspNetWebApi.Selfhost )0 MVC Chat

Page 15: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

Enhanced support for asynchronous methods

0 Support Async in .NET Framework 4.50 TASK<T>

0 New “async”, “await” keyword0 Reduce async code

public async Task<ActionResult> GetSocialDatas(string username){    var facebook = new FBService();    var twitter = new TwitterService();        return View(“SocialData",        new SocialDataViewModel {        FBWalls = await facebook.GetWallsAsync(string username),        TwTimeLines = await twitter.GetTimeLineAsync(string username)    });}

http://wiki.jvmlangsummit.com/images/3/33/Async_in_.NET.pdf

Page 16: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

Demo

0 MVC New Async Operation

Page 17: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

New Mobile Support

0 Mobile Project Template0 jQuery mobile script0 Mobile Theme

Page 18: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

New Mobile Support

0 ViewSwitcher0 Detect device0 Switch view to mobile layout0 Can create layout for device by specification

Page 19: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

Demo

0 New Mobile Support

Page 20: ZZ BC#8 Hello ASP.NET MVC 4 (dks)

End