{"id":2948,"date":"2012-01-19T14:46:03","date_gmt":"2012-01-18T20:46:03","guid":{"rendered":"http:\/\/www.moonmile.net\/blog\/archives\/2948"},"modified":"2012-01-19T14:47:48","modified_gmt":"2012-01-19T05:47:48","slug":"webmatrix-%e3%81%af%e3%81%a9%e3%81%86%e3%82%84%e3%81%a3%e3%81%a6%e3%80%81%e3%83%87%e3%83%bc%e3%82%bf%e3%83%99%e3%83%bc%e3%82%b9%e3%81%ab%e6%8e%a5%e7%b6%9a%e3%81%97%e3%81%a6%e3%81%84%e3%82%8b%e3%81%ae","status":"publish","type":"post","link":"http:\/\/www.moonmile.net\/blog\/archives\/2948","title":{"rendered":"WebMatrix \u306f\u3069\u3046\u3084\u3063\u3066\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u3057\u3066\u3044\u308b\u306e\u304b"},"content":{"rendered":"<p>\nSQL Server Compact \u304c\u5358\u4f53\u3067\u52d5\u304f\u306e\u304b\u3092\u8abf\u3079\u308b\u306e\u3068\u540c\u6642\u306b\u3001\u3061\u3087\u3063\u3068\u4e0d\u601d\u8b70\u3060\u3063\u305f\u306e\u304c WebMatrix \u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u3067\u3059\u3002\u81ea\u52d5\u751f\u6210\u3055\u308c\u308b Raizor \u306e\u30bd\u30fc\u30b9\u3092\u898b\u308b\u9650\u308a LINQ \u3067\u63a5\u7d9a\u3057\u3066\u3044\u308b\u308f\u3051\u3067\u3082\u306a\u3044\u3057\u3001\u3069\u3046\u3044\u3046\u98a8\u306b\u8868\u793a\u3057\u3066\u3044\u308b\u306e\u304b\u306a\u3001\u3068\u601d\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3002\u5177\u4f53\u7684\u306b\u306f\u3001WebMatrix.Data.dll \u3068\u3044\u3046 WebMatrix \u4ed8\u5c5e\u306e\u30c7\u30fc\u30bf\u30a2\u30af\u30bb\u30b9\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002\n<\/p>\n<p>\nwebmatrix \u3092\u8d77\u52d5\u3057\u3066\u3001\u30d9\u30fc\u30ab\u30ea\u30fc\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u81ea\u52d5\u751f\u6210\u3057\u3066\u3001Default.cshtml \u3092\u958b\u304f\u3068\u3001\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n@{\r\n    Page.Title = &amp;quot;Home&amp;quot;;\r\n\r\n    var db = Database.Open(&amp;quot;bakery&amp;quot;);\r\n    var products = db.Query(&amp;quot;SELECT * FROM PRODUCTS&amp;quot;).ToList();\r\n    var featured = products&#x5B;new Random().Next(products.Count)];\r\n}\r\n\r\n&lt;h1&gt;Welcome to Fourth Coffee!&lt;\/h1&gt;\r\n<\/pre>\n<p>\n\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u3053\u306e\u300cDatabase.Open\u300d\u306e\u3068\u3053\u308d\u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u306e\u63a5\u7d9a\u3001\u300cdb.Query\u300d\u3067\u30af\u30a8\u30ea\u306e\u5b9f\u884c\u3001\u3063\u3066\u3053\u3068\u304c\u60f3\u50cf\u3067\u304d\u307e\u3059\u3002<br \/>\nMSDN \u4e0a\u306e\u30d8\u30eb\u30d7\u306f\u3053\u3061\u3089\u3001<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/webmatrix.data.database.open(v=vs.99).aspx\">Database.Open Method (WebMatrix.Data)<\/a>\n<\/p>\n<p>\n\u25a0windows \u30a2\u30d7\u30ea\u3067 webmarix.data.dll \u3092\u4f7f\u3046\n<\/p>\n<p>\n\u306a\u3089\u3070\u3001web \u4e0a\u306e webmatrix \u3058\u3083\u306a\u304f\u3066\u3001windows form \u3067\u3082\u4f7f\u3048\u308b\u306e\u3067\u306f\uff1f\u3068\u601d\u3063\u3066\u8a66\u3057\u306b\u63a5\u7d9a\u3057\u3066\u307f\u307e\u3057\u305f\u3002\n<\/p>\n<p>\n 1.\u5148\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30b5\u30a4\u30c8\u306e bin \u30d5\u30a9\u30eb\u30c0\u306b\u3042\u308b webmatrix.data.dll \u3092\u53c2\u7167\u8a2d\u5b9a<br \/>\n 2.app_data\/bakery.sdf \u3092 windows \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u30b3\u30d4\u30fc\n<\/p>\n<p><img border='0' src='http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2012\/01\/wpid-dworkblogimage20120119_01.jpg'\/><\/p>\n<p>\n 3.\u300cusing WebMatrix.Data;\u300d\u3092\u8ffd\u52a0<br \/>\n 4. \u30b3\u30fc\u30c9\u3092\u8a18\u8ff0\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nstring CNSTR = &quot;app_data\\\\bakery&quot;;\r\nprivate void button1_Click(object sender, EventArgs e)\r\n{\r\n\tvar db = Database.Open(CNSTR);\r\n\tvar products = db.Query(&quot;SELECT * FROM PRODUCTS&quot;).ToList();\r\n\tdataGridView1.DataSource = products;\r\n}\r\n<\/pre>\n<p>\n\u63a5\u7d9a\u6587\u5b57\u5217&#8230;\u3068\u3044\u3046\u304b\u3001Open\u30e1\u30bd\u30c3\u30c9\u306b\u6e21\u3059 string \u306f comapct \u306e\u30c7\u30fc\u30bf\u30d5\u30a1\u30a4\u30eb\u305d\u306e\u3082\u306e\u3067\u3059\u3002\u5b9f\u884c\u30d5\u30a1\u30a4\u30eb\u306e\u30ab\u30ec\u30f3\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304b\u3089\u53c2\u7167\u3055\u308c\u308b\u3088\u3046\u306a\u306e\u3067\u3001&#8221;app_data\\\\bakery&#8221; \u3092\u6e21\u3057\u3066\u304a\u304d\u307e\u3059\u3002\u540c\u3058\u30d5\u30a9\u30eb\u30c0\u306b\u3042\u308b\u5834\u5408\u306f &#8220;bakery&#8221; \u3060\u3051\u3067\u3082 ok \u3067\u3059\u3002\n<\/p>\n<p>\n\u3053\u3046\u3059\u308b\u3068\u3001\u3055\u3063\u304f\u308a\u3068\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002\n<\/p>\n<p><a href='http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2012\/01\/wpid-dworkblogimage20120119_02org.jpg'><img border='0' src='http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2012\/01\/wpid-dworkblogimage20120119_02thum.jpg'\/><\/a><\/p>\n<p>\n\u307e\u3042\u3001windows \u30d5\u30a9\u30fc\u30e0\u306a\u3093\u3060\u304b\u3089 LINQ to Entities \u3092\u4f7f\u3048\u3070\u3088\u3044\u3057\u3001SQL \u6587\u3092\u76f4\u63a5\u8a18\u8ff0\u3057\u305f\u3044\u5834\u5408\u306b\u306f SqlCommand \u3084 SqlDataAdapter \u3092\u4f7f\u3048\u3070\u3088\u3044\u306e\u3067\u3001\u3042\u307e\u308a\u30e1\u30ea\u30c3\u30c8\u306f\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u3055\u3063\u304f\u308a\u3068\u63a5\u7d9a\u3057\u305f\u3068\u304d\u306b\u306f\u4fbf\u5229&#8230;\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u306d\u3002\n<\/p>\n<p>\n\u25a0\u3061\u306a\u307f\u306b\u3001webmatrix.data.dll \u3068 *.exe \u3060\u3051\u3067\u52d5\u304f\u306e\u304b\uff1f\n<\/p>\n<p>\n\u3068\u3001\u809d\u5fc3\u306a\u3053\u3068\u3092\u3002\n<\/p>\n<p>\n\u3053\u306e webmatrix.data.dll \u3068 *.exe \u3001*.sdf\uff08\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30d5\u30a1\u30a4\u30eb\uff09\u3092 windows 7 \u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306b\u30b3\u30d4\u30fc\u3059\u308b\u3060\u3051\u3067\u52d5\u4f5c\u3059\u308b\u306e\u304b\u3069\u3046\u304b\uff1f\u3001\u3068\u8a66\u3057\u3066\u307f\u305f\u306e\u3067\u3059\u304c\u99c4\u76ee\u3067\u3057\u305f\u3002\u5225\u9014\u3001\u300csql server compact edition\u300d\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002SQL Server \u306e express edition \u3092\u5165\u308c\u308b\u3088\u308a\u306f\u8efd\u3044\u3068\u306f\u3044\u3048\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u306a\u3044\u3068\u4f7f\u3048\u306a\u3044\u306e\u306f\u306a\u3041\u3001\u3068\u3044\u3046\u61f8\u5ff5\u304c\u3002\n<\/p>\n<p>\n\u3053\u3046\u306a\u308b\u3068\u3001\u30c7\u30fc\u30bf\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3059\u308b\u3060\u3051\u3067\u52d5\u4f5c\u53ef\u80fd\uff08\u4ed6\u306e\u30bb\u30c3\u30c6\u30a3\u30f3\u30b0\u304c\u4e0d\u8981\uff09\u306a\u306e\u306f\u3001\n<\/p>\n<ul>\n<li>SQLite\uff08\u672a\u691c\u8a3c\uff09<\/li>\n<li>Access<\/li>\n<\/ul>\n<p>\n\u3063\u3066\u3068\u3053\u308d\u3067\u3059\u304b\u306d\u3002XML \u30d5\u30a1\u30a4\u30eb\u3092\u7528\u610f\u3057\u3066\u3001linq to xml \u3067\u691c\u7d22\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u306a\u306e\u3067\u3059\u304c\u3001\u30ac\u30c3\u30c4\u30ea\u8aad\u307f\u8fbc\u3093\u3067\u3057\u307e\u3046\u306e\u3067\u3001\u3067\u304b\u3044\u30d5\u30a1\u30a4\u30eb\uff08100MB\u306e\u30d5\u30a1\u30a4\u30eb\u3068\u304b\uff09\u306f\u3061\u3087\u3063\u3068\u306a\u3041\u3068\u3044\u3046\u611f\u3058\u304c\u3059\u308b\u306e\u3067\u3059\u3002\u3082\u3063\u3068\u3082\u3001\u305d\u308c\u3060\u3051\u5927\u304d\u304f\u306a\u308b\u3068\u3001access \u3067\u306f\u99c4\u76ee\u306a\u3088\u3046\u306a\u6c17\u3082\u3057\u307e\u3059\u304c\u3002\u3053\u308c\u306f\u8981\u691c\u8a3c\u3068\u3044\u3046\u3053\u3068\u3067\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL Server Compact \u304c\u5358\u4f53\u3067\u52d5\u304f\u306e\u304b\u3092\u8abf\u3079\u308b\u306e\u3068\u540c\u6642\u306b\u3001\u3061\u3087\u3063\u3068\u4e0d\u601d\u8b70\u3060\u3063\u305f\u306e\u304c WebMatrix \u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u3067\u3059\u3002\u81ea\u52d5\u751f\u6210\u3055\u308c\u308b Raizor \u306e\u30bd\u30fc\u30b9\u3092\u898b\u308b\u9650\u308a LINQ \u3067\u63a5\u7d9a\u3057\u3066\u3044\u308b\u308f &hellip; <a href=\"http:\/\/www.moonmile.net\/blog\/archives\/2948\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[23,39],"tags":[],"class_list":["post-2948","post","type-post","status-publish","format-standard","hentry","category-csharp","category-39"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/2948","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/comments?post=2948"}],"version-history":[{"count":1,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/2948\/revisions"}],"predecessor-version":[{"id":2949,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/2948\/revisions\/2949"}],"wp:attachment":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=2948"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=2948"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=2948"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}