{"id":201,"date":"2020-05-19T16:59:25","date_gmt":"2020-05-19T07:59:25","guid":{"rendered":"http:\/\/sumomo.ohwaki.jp\/wordpress\/?p=201"},"modified":"2020-05-19T17:12:02","modified_gmt":"2020-05-19T08:12:02","slug":"ef-core%e3%81%a7sql-server%e3%81%ae%e3%83%95%e3%83%ab%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%a4%e3%83%b3%e3%83%87%e3%83%83%e3%82%af%e3%82%b9%e3%82%92%e4%bd%bf%e3%81%86","status":"publish","type":"post","link":"https:\/\/sumomo.ohwaki.jp\/wordpress\/?p=201","title":{"rendered":"EF Core\u3067SQL Server\u306e\u30d5\u30eb\u30c6\u30ad\u30b9\u30c8\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f7f\u3046"},"content":{"rendered":"\n<p>Entity Framework Core\u3067SQL Server\u306e\u30d5\u30eb\u30c6\u30ad\u30b9\u30c8\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f7f\u7528\u3057\u305f\u691c\u7d22\u3092\u4f7f\u3063\u305f\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3057\u3066\u307f\u305f\u3002<\/p>\n\n\n\n<p>SQL Server\u306e\u30d5\u30eb\u30c6\u30ad\u30b9\u30c8\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f\u3001\u5bfe\u8c61\u30c6\u30fc\u30d6\u30eb\u306e\u884c\u306b\u5bfe\u3057\u3066\u3001\u30e6\u30cb\u30fc\u30af\u30ad\u30fc\u3092\u6307\u5b9a\u3057\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3002\u4f8b\u3048\u3070\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30c6\u30fc\u30d6\u30eb\u69cb\u6210\u306b\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sumomo.ohwaki.jp\/wordpress\/wp-content\/uploads\/2020\/05\/entity.png\" alt=\"\" class=\"wp-image-202\" width=\"320\" height=\"380\"\/><\/figure>\n\n\n\n<p>\u691c\u7d22\u7d50\u679c\u3068\u3057\u3066\u3001\u3053\u306e\u30ad\u30fc\u3060\u3051\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u3001CONTAINSTABLE\u95a2\u6570\u3067\u3001\u30c6\u30fc\u30d6\u30eb\u3068\u30ab\u30e9\u30e0\u3001\u691c\u7d22\u6587\u5b57\u5217\u3092\u6307\u5b9a\u3059\u308c\u3070\u826f\u3044\u3002\u4e0a\u8a18\u69cb\u6210\u3067\u3001\u5bfe\u8c61\u30c6\u30fc\u30d6\u30eb\u306e\u30ab\u30e9\u30e0\u30c7\u30fc\u30bf\u4e2d\u304b\u3089\u6307\u5b9a\u6587\u5b57\u5217\u3092\u6301\u3064\u884c\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306aSQL\u3092\u767a\u884c\u3059\u308b\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-sql\" data-file=\"\u30d5\u30eb\u30c6\u30ad\u30b9\u30c8\u691c\u7d22\" data-lang=\"SQL\"><code>select * from BusinessHistoryDetail d where d.FullTextUniqKey\n                in (select [KEY] from CONTAINSTABLE(BusinessHistoryDetail,*,&#39;&quot;C#*&quot;&#39;))<\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u308c\u306b\u3088\u308a\u3001\u5168\u3066\u306e\u30ab\u30e9\u30e0\u3092\u5bfe\u8c61\u306b\u6307\u5b9a\u3057\u305f\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u542b\u3080\u3001\u30ec\u30b3\u30fc\u30c9\u306e\u30e6\u30cb\u30fc\u30af\u30ad\u30fc\u3092\u53d6\u5f97\u3059\u308b\u4e8b\u304c\u53ef\u80fd\u3067\u3042\u308b\u3002<\/p>\n\n\n\n<p>EF Core\u3067\u751fSQL\u3092\u767a\u884c\u3057\u305f\u7d50\u679c\u3092LINQ\u30af\u30a8\u30ea\u306b\u8fd4\u3059\u306b\u306fFromSqlRaw\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3002\u4e0a\u8a18\u306e\u4f8b\u3067\u3001\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\u7d50\u679c\u3092\u30d9\u30fc\u30b9\u3068\u3057\u3066\u3001\u6c0f\u540d\u306a\u3069\u3082\u7d50\u679c\u3068\u3057\u3066\u53d6\u308a\u305f\u3044\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u611f\u3058\u306e\u30af\u30a8\u30ea\u3092\u767a\u884c\u3059\u308c\u3070\u3088\u3044\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-csharp\" data-file=\"EF\u30af\u30a8\u30ea\" data-lang=\"C#\"><code>\/\/ \u691c\u7d22\u30ad\u30fc\u30ef\u30fc\u30c9\u306fstrkeyw\u306b\u5165\u529b\u3055\u308c\u3066\u3044\u308b\n\/\/ \u30d5\u30eb\u30c6\u30ad\u30b9\u30c8\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u691c\u7d22\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u306f&quot;&lt;\u30ad\u30fc\u30ef\u30fc\u30c9&gt;*&quot;\u306e\u5f62\u3067\u6307\u5b9a\nstring keyw = @&quot;&quot;&quot;&quot; + strkeyw + &quot;*&quot;&quot;&quot;; \nvar q = from d in ctx.BusinessHistoryDetail.FromSqlRaw(\n    @&quot;select * from BusinessHistoryDetail d \n        where d.FullTextUniqKey\n        in (select [KEY] from CONTAINSTABLE(BusinessHistoryDetail,*,{0}))&quot;,keyw)\n    join h in ctx.BusinessHistoryHeader on d.EmployeeNo equals h.EmployeeNo\n    select new {\n        EmpNo = d.EmployeeNo,\n        Name = h.Name,\n        Project = d.ProjectName,\n        Customer = d.CustomerName,\n        OS = d.OS,\n        Language = d.Language,\n        Tools = d.Tools\n    };<\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u30d5\u30eb\u30c6\u30ad\u30b9\u30c8\u691c\u7d22\u3092\u884c\u3046\u4e8b\u304c\u3067\u304d\u305f\u3002<\/p>\n\n\n\n<p>\u306a\u305c\u3001\u30d5\u30eb\u30c6\u30ad\u30b9\u30c8\u691c\u7d22\u3092EF Core\u3067\u3084\u308a\u305f\u304b\u3063\u305f\u306e\u304b\u3068\u3044\u3046\u3068\u3001\u4ee5\u524d\u4f5c\u6210\u3057\u305f\u793e\u5185\u30b7\u30b9\u30c6\u30e0\u3092dotnet core\u306b\u7f6e\u304d\u63db\u3048\u305f\u3044\u304b\u3089\u3002<br>\u4ee5\u524d\u306e\u30b7\u30b9\u30c6\u30e0\u3067\u3082\u30d5\u30eb\u30c6\u30ad\u30b9\u30c8\u691c\u7d22\u3092\u884c\u3063\u3066\u3044\u308b\u304c\u3001\u305d\u306e\u90e8\u5206\u3060\u3051\u3001EF\u30af\u30a8\u30ea\u3067\u306f\u306a\u304f\u3001SqlClient\u3092\u4f7f\u308f\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u304b\u3063\u305f\u305f\u3081\u3002<br>\u300cEF\u3060\u3051\u3067\u51fa\u6765\u308c\u3070\u3044\u3044\u306e\u306b\u306a\u3041\u300d\u3068\u601d\u3063\u3066\u3044\u305f\u306e\u3067\u3002<\/p>\n\n\n\n<p>\u307e\u3041\u3001EF\u4f7f\u3063\u3066\u308b\u306e\u306bSQL\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u76f4\u66f8\u304d\u3059\u308b\u306e\u306f\u5982\u4f55\u306a\u7269\u304b\u3068\u3082\u601d\u3046\u3051\u3069\u30fb\u30fb\u30fb<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Entity Framework Core\u3067SQL Server\u306e\u30d5\u30eb\u30c6\u30ad\u30b9\u30c8\u30a4 &hellip; <a href=\"https:\/\/sumomo.ohwaki.jp\/wordpress\/?p=201\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,11,14,4],"tags":[],"class_list":["post-201","post","type-post","status-publish","format-standard","hentry","category-c","category-dotnetcore","category-entity-framework","category-4"],"_links":{"self":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=201"}],"version-history":[{"count":3,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/201\/revisions"}],"predecessor-version":[{"id":205,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/201\/revisions\/205"}],"wp:attachment":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}