About me
0 Chalermpon Areepong
   0 Microsoft MVP Thailand (ASP.NET)
0 Work for ICBC THAI
0 Blog http://nine69.wordpress.com
0 User Group
 https://www.facebook.com/groups/MVCTHAIDEV
AGENDA
0 Enhancement to default project template
0 New Razor 2.0
0 Bundling and Minification
0 ASP.NET WEB APIs
0 Enhanced support for asynchronous methods
0 New Mobile Support
Enhancements to Default
     Project Templates
0 Design for adaptive rendering to look good in both
 desktop browsers and mobile browsers without any
 customization.
Demo
0 Show new default project template
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
Demo
0 Razor 2
Bundling and Minifacation
0 Reduce size of script and css file (remove whitespace)
0 New App_Start Folder
  0 BundleConfig.cs
0 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 View
   @Scripts.Render("~/bundles/jquery")
   @Styles.Render("~/Content/themes/base/css", "~/Content/css")
Demo
0 Bundling and Minifacation
ASP.NET WEB APIs
0 Change name from WCF Web API
0 Easy to build HTTP services
0 Support Browsers and Mobile devices
0 Build RESTful applications on the .NET Framework
ASP.NET WEB APIs
               HTTP get, post, etc.




 Device App
                    Request
                 json, xml, form

                                      ASP.NET
  Web App
                                      WEB API
                      Response
                      json, xml
   Others
HTTP Request
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 base
0   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
ASP.NET WEB APIs
0 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.
Demo
0 Basic Web API
0 SelfHost ( AspNetWebApi.Selfhost )
0 MVC Chat
Enhanced support for
    asynchronous methods
0 Support Async in .NET Framework 4.5
   0 TASK<T>
0 New “async”, “await” keyword
0 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
Demo
0 MVC New Async Operation
New Mobile Support
0 Mobile Project Template
  0 jQuery mobile script
  0 Mobile Theme
New Mobile Support
0 ViewSwitcher
   0 Detect device
   0 Switch view to mobile layout
   0 Can create layout for device by specification
Demo
0 New Mobile Support
End

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

  • 2.
    About me 0 ChalermponAreepong 0 Microsoft MVP Thailand (ASP.NET) 0 Work for ICBC THAI 0 Blog http://nine69.wordpress.com 0 User Group https://www.facebook.com/groups/MVCTHAIDEV
  • 3.
    AGENDA 0 Enhancement todefault project template 0 New Razor 2.0 0 Bundling and Minification 0 ASP.NET WEB APIs 0 Enhanced support for asynchronous methods 0 New Mobile Support
  • 4.
    Enhancements to Default Project Templates 0 Design for adaptive rendering to look good in both desktop browsers and mobile browsers without any customization.
  • 5.
    Demo 0 Show newdefault project template
  • 6.
    New Razor 2.0 0Razor now supports conditional attributes. In an HTML element <input type="checkbox“ name="check1" value="check1" checked="@checked1" /> 0 Support path “~/” for all HTML attributes
  • 7.
  • 8.
    Bundling and Minifacation 0Reduce size of script and css file (remove whitespace) 0 New App_Start Folder 0 BundleConfig.cs 0 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 View @Scripts.Render("~/bundles/jquery") @Styles.Render("~/Content/themes/base/css", "~/Content/css")
  • 9.
    Demo 0 Bundling andMinifacation
  • 10.
    ASP.NET WEB APIs 0Change name from WCF Web API 0 Easy to build HTTP services 0 Support Browsers and Mobile devices 0 Build RESTful applications on the .NET Framework
  • 11.
    ASP.NET WEB APIs HTTP get, post, etc. Device App Request json, xml, form ASP.NET Web App WEB API Response json, xml Others HTTP Request
  • 12.
    ASP.NET WEB APIs 0Modern 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 base 0 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
  • 13.
    ASP.NET WEB APIs 0Code-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.
  • 14.
    Demo 0 Basic WebAPI 0 SelfHost ( AspNetWebApi.Selfhost ) 0 MVC Chat
  • 15.
    Enhanced support for asynchronous methods 0 Support Async in .NET Framework 4.5 0 TASK<T> 0 New “async”, “await” keyword 0 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
  • 16.
    Demo 0 MVC NewAsync Operation
  • 17.
    New Mobile Support 0Mobile Project Template 0 jQuery mobile script 0 Mobile Theme
  • 18.
    New Mobile Support 0ViewSwitcher 0 Detect device 0 Switch view to mobile layout 0 Can create layout for device by specification
  • 19.
  • 20.