{"id":8603,"date":"2017-05-10T12:01:51","date_gmt":"2017-05-10T03:01:51","guid":{"rendered":"http:\/\/www.moonmile.net\/blog\/?p=8603"},"modified":"2017-06-09T08:48:11","modified_gmt":"2017-06-08T23:48:11","slug":"azure-%e4%b8%8a%e3%81%ae-net-core-%e3%81%a7%e3%81%af-dbset-%e3%81%ae-join-%e3%81%8c%e3%81%a7%e3%81%8d%e3%81%aa%e3%81%84","status":"publish","type":"post","link":"http:\/\/www.moonmile.net\/blog\/archives\/8603","title":{"rendered":"Azure \u4e0a\u306e .NET Core \u3067\u306f DbSet \u306e Join \u304c\u3067\u304d\u306a\u3044"},"content":{"rendered":"<p>\u3072\u3069\u304f\u30d4\u30f3\u30dd\u30a4\u30f3\u30c8\u304b\u30643\u6642\u9593\u307b\u3069\u30cf\u30de\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3001\u30e1\u30e2\u66f8\u304d\u7684\u306b\u6b8b\u3057\u3066\u304a\u304f\u3002<\/p>\n<p>\u74b0\u5883\u306f\u3001<\/p>\n<ul>\n<li>ASP.NET Core<\/li>\n<li>.NET Core 1.1<\/li>\n<li>EF Core \u3092\u5229\u7528<\/li>\n<\/ul>\n<p>ASP.NET Core \u3067 Web API \u3092\u4f5c\u3063\u3066\u3044\u3066\u3001\u30ed\u30fc\u30ab\u30eb\u306e .NET Core \u3067 LINQ \u306e Join \u304c\u52d5\u3044\u3066\u3044\u305f\u306e\u3060\u304c\u3001\u3044\u3056 Azure \u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3066\u52d5\u4f5c\u3055\u305b\u308b\u3068\u3001Join \u90e8\u5206\u304c\u3046\u307e\u304f\u3044\u304b\u306a\u304f\u3066\u610f\u5473\u4e0d\u660e\u306a\u30a8\u30e9\u30fc\u3092\u8fd4\u3057\u305f\u3002<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nvar cnt1 = (\r\n        from ti in _context.TicketView\r\n        join st in _context.Status on ti.Status_Id equals st.Id\r\n        where ti.ProjectId == project.Id &&\r\n                ti.Tracker_Id == tr.Id &&\r\n                st.IsClosed == false\r\n        select ti.Id\r\n    ).Count();\r\n<\/pre>\n<p>\u3068\u3042\u308b\u3068\u3053\u308d\u3067\u3001\u3053\u3093\u306a\u98a8\u306b TicketView \u3068 Statues \u30c6\u30fc\u30d6\u30eb\u3092 JOIN \u3055\u305b\u305f\u3002\u4f55\u3092\u3084\u308a\u305f\u304b\u3063\u305f\u304b\u3068\u3044\u3046\u3068\u3001Statues \u30c6\u30fc\u30d6\u30eb\u306e IsClosed \u30d5\u30e9\u30b0\u3092\u898b\u3066\u3001\u305d\u306e\u6570\u3092\u30ab\u30a6\u30f3\u30c8\u3057\u305f\u304b\u3063\u305f\u306e\u3060\u3002\u3053\u308c\u3092\u3001\u30ed\u30fc\u30ab\u30eb PC \u306e ASP.NET Core \u3067\u52d5\u4f5c\u3055\u305b\u308b\u3068\u3001\u3059\u308b\u3059\u308b\u3068\u52d5\u3044\u305f\u306e\u3067\u3001\u305d\u306e\u307e\u307e Azure \u306b\u4e57\u305b\u3066\u307f\u308b\u3068\u2026<\/p>\n<p>\u30c6\u30fc\u30d6\u30eb\u69cb\u9020\u304c\u9055\u3063\u3066\u3044\u308b\u304b\u3089\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3057\u308d\u3001<\/p>\n<p>\u3068\u3044\u3046\u304a\u9054\u3057\u304c\u6765\u308b\u3002\u6700\u521d\u306f\u3001\u30a8\u30e9\u30fc\u306e\u610f\u5473\u304c\u89e3\u3089\u306a\u304f\u3066\u56db\u82e6\u516b\u82e6\u3057\u305f\u306e\u3060\u304c\u3001\u5c11\u3057\u305a\u3064\u969c\u5bb3\u3092\u7d5e\u308a\u8fbc\u3093\u3067\u3044\u304f\u3068\u3053\u3053\u306e JOIN \u90e8\u5206\u306b\u81f3\u3063\u305f\u3002\u3053\u306e JOIN \u3092\u6d88\u3057\u3066\u3057\u307e\u3063\u3066\u3001var cnt1 = 0 \u3068\u3059\u308b\u3068\u52d5\u4f5c\u3059\u308b\u3053\u3068\u304c\u5206\u304b\u3063\u305f\u306e\u3067\u3001\u3042\u308c\u3053\u308c\u3084\u3063\u3066\u3001<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nvar status = _context.Status.OrderBy(x =&amp;gt; x.Position).ToList();\r\nvar ticketviews = _context.TicketView.Where(x =&amp;gt; x.ProjectId == project.Id).ToList();\r\n\r\nvar cnt1 = (from ti in ticketviews\r\n            join st in status on ti.Status_Id equals st.Id \r\n            where ti.ProjectId == project.Id &&\r\n                    ti.Tracker_Id == tr.Id &&\r\n                    st.IsClosed == false\r\n            select ti.Id).Count();\r\n<\/pre>\n<p>\u306a\u98a8\u306b\u3001\u4e00\u5ea6 List \u306b\u53d6\u308a\u8fbc\u3093\u3067\u304b\u3089 JOIN \u3059\u308b\u3068\u3046\u307e\u304f\u52d5\u304f\u3088\u3046\u306b\u306a\u3063\u305f\u3002<\/p>\n<p>LINQ \u3092\u4f7f\u3063\u3066\u30b8\u30a7\u30cd\u30ea\u30c3\u30af\u306e List \u540c\u58eb\u3092 Join \u3055\u305b\u308b\u5206\u306b\u306f\u5927\u4e08\u592b\u3068\u89e3\u3063\u3066\u3044\u308b\u306e\u3060\u304c\u3001_context.Status \u306e\u307b\u3046\uff08DbSet&lt;Status&gt; \u306a\u3069\u3067 DI \u3055\u308c\u3066\u3044\u308b\uff09\u306e Join \u306e\u52d5\u4f5c\u304c\u4e0d\u660e\u3067\u3042\u308b\u3002\u3082\u3068\u3082\u3068\u3001\u30ed\u30fc\u30ab\u30eb PC \u3067 DbSet \u540c\u58eb\u306e Join \u304c\u3067\u304d\u3061\u3083\u3046\u306e\u304c\u304a\u304b\u3057\u3044\u306e\u304b\u3001\u305d\u308c\u3068\u3082 Azure \u4e0a\u306e .NET Core \u3067 DbSet \u540c\u58eb\u306e Join \u304c\u3067\u304d\u306a\u3044\u306e\u304c\u304a\u304b\u3057\u3044\u306e\u304b\u3002<\/p>\n<p>\u3069\u3061\u3089\u306b\u305b\u3088\u3001\u540c\u3058\u30b3\u30fc\u30c9\u3092\u30ed\u30fc\u30ab\u30eb PC \u3068 Azure \u4e0a\u3067\u52d5\u304b\u3057\u305f\u3068\u304d\u306b\u3001\u6319\u52d5\u304c\u9055\u3046\u306e\u306f\u300c\u304a\u304b\u3057\u3044\u300d\u306e\u3067\u3001\u3053\u3053\u306f\u8abf\u3079\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3002\u3053\u308c\u3001Linux \u4e0a\u306e .NET Core \u3060\u3068\u3069\u3046\u306a\u306e\u3060\u308d\u3046\u304b\uff1f \u5f8c\u3067\u8abf\u3079\u308b\u304b\u601d\u6848\u4e2d\u3002<\/p>\n<p>\u8ffd\u8a18 2017\/05\/11<\/p>\n<p>Ubuntu \u306b donet 1.0.3 \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u69cb\u7bc9\u3057\u3066\u307f\u308b\u3068\u3001\u4e0a\u306e Join \u304c\u52d5\u304f\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3067\u3001Azure \u4e0a\u3060\u3051\u304c\u30c0\u30e1\u306a\u6a21\u69d8\u3002<\/p>\n<p>Azure \u306e App Service \u306e\u30b3\u30f3\u30bd\u30fc\u30eb\u3067\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u8abf\u3079\u308b\u3068 doetnet \u30b3\u30de\u30f3\u30c9\u81ea\u4f53\u304c 1.0.1 \u3001.net core \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c Version\u00a0 : 1.1.0-preview1-001100-00 \u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u306e\u9055\u3044\u3068\u601d\u308f\u308c\u308b\u3002\u3061\u306a\u307f\u306b\u3001\u30ed\u30fc\u30ab\u30ebPC \u306e\u5834\u5408\u306f\u30011.1.0 \u306b\u306a\u3063\u3066\u3044\u308b\u3002\u3053\u306e\u5fae\u5999\u306a\u5dee\uff08Azure \u306e\u307b\u3046\u304c preview\u306e\u307e\u307e\u306a\u306e\u304c\uff09\u539f\u56e0\u3089\u3057\u3044\u3002<\/p>\n<p>Build 2017 \u306e\u5fae\u5999\u306a\u6642\u671f\u306a\u306e\u3067\u3001\u3053\u308c\u304c\u7d42\u308f\u308b\u3068 2.0 \u306b\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3055\u308c\u308b\u304b\u3082\u3057\u308c\u3093\u3002<\/p>\n<p>\u8ffd\u8a18 2017\/05\/19<\/p>\n<p>\u73fe\u6642\u70b9\u3067\u3001.NET Command Line Tools (2.0.0-preview1-005977)\u00a0 \u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3001join \u304c\u6b63\u5e38\u306b\u52d5\u3044\u3066\u3044\u308b\u3002\u3084\u3063\u305f\u30fc\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3072\u3069\u304f\u30d4\u30f3\u30dd\u30a4\u30f3\u30c8\u304b\u30643\u6642\u9593\u307b\u3069\u30cf\u30de\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3001\u30e1\u30e2\u66f8\u304d\u7684\u306b\u6b8b\u3057\u3066\u304a\u304f\u3002 \u74b0\u5883\u306f\u3001 ASP.NET Core .NET Core 1.1 EF Core \u3092\u5229\u7528 ASP.NET Core \u3067 Web API \u3092\u4f5c\u3063 &hellip; <a href=\"http:\/\/www.moonmile.net\/blog\/archives\/8603\">\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":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[31,92],"tags":[],"class_list":["post-8603","post","type-post","status-publish","format-standard","hentry","category-azure","category-openccpm"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/8603","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=8603"}],"version-history":[{"count":9,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/8603\/revisions"}],"predecessor-version":[{"id":8614,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/8603\/revisions\/8614"}],"wp:attachment":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=8603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=8603"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=8603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}