netラボ2012年3月勉強会ライトニングトーク

9
A look at ASP.NET MVC4 日本語解説 Twitter: david9142 Blog: テスターですが何か? http://david9142.wordpress.com/

Upload: david9142

Post on 11-Jul-2015

2.442 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Netラボ2012年3月勉強会ライトニングトーク

A look at ASP.NET MVC4 日本語解説

Twitter: david9142

Blog: テスターですが何か? http://david9142.wordpress.com/

Page 2: Netラボ2012年3月勉強会ライトニングトーク

A look at ASP.NET MVC4

2/19にオランダで行われた「TechDays 2012」

Scott Guthrieのセッション動画の日本語解説

動画はChannel9で公開 http://p.tl/rkxE

Page 3: Netラボ2012年3月勉強会ライトニングトーク

ASP.NET MVC4新機能

Bundling/Minification Support

Database Migration

Web APIs

Mobile Web

Real Time Communication

Asynchronous Support

Page 4: Netラボ2012年3月勉強会ライトニングトーク

Bundling/Minification Support(1)

今まではこう書いていた

<link href="styles/reset.css" rel="Stylesheet" />

<link href="styles/styles.css" rel="Stylesheet" />

<link href="styles/content.css" rel="Stylesheet" />

<link href="styles/glocals.css" rel="Stylesheet" />

<link href="styles/forms.css" rel="Stylesheet" />

<link href="styles/menu.css" rel="Stylesheet" />

これだと6回のHTTPリクエスト/レスポンスが発生する

Page 5: Netラボ2012年3月勉強会ライトニングトーク

Bundling/Minification Support(2)

こう書ける、ディレクトリ指定

<link href="styles/css" rel="Stylesheet" />

HTTP通信は1回のみ

改行、空白がカットされ通信料も削減

JavaScriptの場合はこう

<script src="scripts/js"></script>

Page 6: Netラボ2012年3月勉強会ライトニングトーク

Database Migration

Entiry Framework4.3よりCode FirstにDatabase Migration機能が追加

• Modelクラスの変更をデータベースへ反映可能

• ロールバックも可能

• モデル変更時の変更処理(C#/VB/SQL)を自動生成

• Enable-Migration, Add-Migration, Update-Databaseコマンド

Page 7: Netラボ2012年3月勉強会ライトニングトーク

Mobile Web

モバイル(PC以外のデバイス)向けのページを作成する機能

Adaptive Rendering • CSS Media Queryでウィンドウの大きさに応じてレイアウトが調整

Display Modes • デバイスに応じてViewをオーバーライ

Mobile Templates • jQueryMobileを使用したモバイルサイト用テンプレートを用意

Page 8: Netラボ2012年3月勉強会ライトニングトーク

Real Time Communication

双方向通信処理

ASP.NET 4.5でWebSocketをサポート

SignalRがGitHubで公開されている

(マルチユーザー向けのリアルタイムWeb作成用

ライブラリ)

Page 9: Netラボ2012年3月勉強会ライトニングトーク

Asynchronous Support

非同期処理(ASP.NETだけではなく、.NET4.5の新機能)

async/awaitキーワードを使用して以下のように記述できる

public class Products : Controller

{

public async Task<ActionResult> IndexAsync()

{

webClient web = new WebClient();

string result = await web.DownloadStringAsync("www.bing.com");

return View();

}

}