{"id":33,"date":"2023-11-24T14:29:13","date_gmt":"2023-11-24T06:29:13","guid":{"rendered":"https:\/\/dimtechstudio.com\/?p=33"},"modified":"2023-11-25T18:38:30","modified_gmt":"2023-11-25T10:38:30","slug":"%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81","status":"publish","type":"post","link":"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/","title":{"rendered":"\u8001\u6d3eSql\u4e4b\u5fc5\u8981"},"content":{"rendered":"<p><a href=\"https:\/\/www.dimtechstudio.com\/\"><img decoding=\"async\" src=\"\/dimwalker\/Wlkr.MyNote\/raw\/master\/2023\/11\/24\/vx_images\/DimTechStudio-Logo.png\" alt=\"DimTechStudio.Com\" \/><\/a><\/p>\n<h1>Wlkr.Core.EFCore<\/h1>\n<p>\u9006\u5929\uff0c\u6211\u5728ef core\u4e2d\u4f7f\u7528ado.net\uff01<\/p>\n<h1>\u8001\u6d3eSql\u4e4b\u5fc5\u8981<\/h1>\n<ul>\n<li>\u5f53\u4f60\u5f00\u53d1\u751f\u6daf\u4e2d\u57fa\u672c\u53ea\u7528\u4e00\u4e24\u79cd\u6570\u636e\u5e93<\/li>\n<li>\u5f53\u4f60\u89c9\u5f97\u7528EF\u7684\u7c7b\u5199\u62a5\u8868\u65f6\u5f88\u522b\u626d<\/li>\n<li>\u5f53\u4f60\u89c9\u81ea\u5df1\u7684Sql( Server)\u8bed\u53e5\u5199\u5f97\u51fa\u795e\u5165\u5316<\/li>\n<li>\u5f53\u4f60\u89c9\u81ea\u5df1\u7684Sql( Server)\u8bed\u53e5\u6bd4EF\u751f\u6210\u7684\u66f4\u4f18\u5316<\/li>\n<li>\u5f53\u4f60\u521a\u4ece.net framework\u8f6c.net core\uff0c\u8fd8\u4e0d\u77e5\u9053sqlsugar\u548cdapper<\/li>\n<\/ul>\n<p>\u5982\u4e0a\u9762\u6240\u8bf4\uff0c\u672c\u9879\u76ee\u5728\u51e0\u5e74\u524d\uff0c\u7b14\u8005\u521a\u8f6c\u5230.net core 3.1\u7684\u5f00\u53d1\u4e2d\uff0c\u7f16\u5199\u4e86\u6b64\u9879\u76ee\u3002<br \/>\n\u5f53\u65f6\u89c9\u5f97ef core\u8fd9\u7684\u5f88\u5f3a\u5927\uff0c\u7f16\u5199\u4e1a\u52a1\u4ee3\u7801\u65f6\uff0c\u6548\u7387\u63d0\u5347\u6781\u9ad8\uff0c\u5c42\u6b21\u7ed3\u6784\u3001\u903b\u8f91\u4ee3\u7801\u90fd\u5f88\u6e05\u6670\u7edf\u4e00\u3002<br \/>\n\u4f46\u662f\u5230\u4e86\u5f00\u53d1\u62a5\u8868\u65f6\uff0c\u591a\u8868\u5173\u8054\uff0c\u5947\u8469\u6761\u4ef6\u7ec4\u5408\u5c31\u663e\u793a\u5f88\u522b\u626d\uff0c\u5404\u79cd\u5947\u602a\u7684select\uff0cjoin\uff0cwhere\u7b49\u64cd\u4f5c\u7528\u4e8e\u7c7b\u4e2d\uff0c\u4ee4\u4eba\u6293\u72c2\uff0c\u5728sql\u8bed\u53e5\u4e2d\u53ef\u80fd\u51e0\u884c\u80fd\u5199\u5b8c\u7684\u4e1c\u897f\uff0c\u5938\u5f20\u70b9\u53ef\u80fd\u5f97\u5199\u4e0a\u51e0\u5341\u884c\uff0c\u5373\u4fbf\u6709linq\u548clambda\u7684\u8f85\u52a9\uff0c\u4e5f\u6ca1\u6709\u76f4\u63a5\u5199sql\u597d\u7528\u3002<br \/>\n\u4e8e\u662f\u4fbf\u8bde\u751f\u4e86\u6b64\u9879\u76ee\u3002<\/p>\n<h1>\u98df\u7528\u65b9\u5f0f<\/h1>\n<p><code>EFCoreQueryHelper<\/code>\u6b64\u7c7b\u57fa\u672c\u529f\u80fd\u5206\u4e3aSqlQuery\uff0cSqlNonQuery\uff0cSqlScalar\uff0cReader\u53caDataSet\u3002<br \/>\n\u6bcf\u4e2a\u7c7b\u578b\u67093\u4e2d\u63a5\u53e3<\/p>\n<ul>\n<li>\u7b2c\u4e00\u79cd\u76f4\u63a5\u4f7f\u7528<code>string<\/code>\uff0c\u4e0d\u80fd\u9632\u6b62SQL\u6ce8\u5165\u3002<\/li>\n<li>\u7b2c\u4e8c\u79cd\u4f7f\u7528<code>FormattableString<\/code>\uff0c\u80fd\u9632\u6b62SQL\u6ce8\u5165<\/li>\n<li>\u7b2c\u4e09\u79cd\u6211\u5c01\u88c5\u7684<code>SqlFormatter<\/code>\uff0c\u5b9e\u73b0\u50cfStringBuilder\u4e00\u6837\u62fc\u63a5<code>FormattableString<\/code>\u3002<\/li>\n<\/ul>\n<p>Console\u9879\u76ee\u201cEFCoreSample\u201d\u91cc\u9762\u6709\u4e00\u4e9b\u4f7f\u7528\u793a\u4f8b<\/p>\n<h2>\u73af\u5883\u51c6\u5907<\/h2>\n<ul>\n<li>\u4f60\u9700\u8981Sql server\uff0c.net6 SDK<\/li>\n<li>\u5728Console\u4e2d\u9ed8\u8ba4\u6ca1\u6709\u4eceappsettings.json\u8bfb\u53d6config\u7684\u529f\u80fd\uff0c\u6b64\u5904\u6211\u4eec\u81ea\u5df1\u5148\u6784\u9020\u4e00\u4e2aconfig\u3002\n<pre><code class=\"language-C#\">\/\/\u8bfb\u53d6Config\nvar configuration = new ConfigurationBuilder()\n    .SetBasePath(AppContext.BaseDirectory) \/\/ \u8bbe\u7f6e\u57fa\u7840\u8def\u5f84\u4e3a\u5e94\u7528\u7a0b\u5e8f\u6839\u76ee\u5f55\n    .AddJsonFile(&quot;appsettings.json&quot;, optional: true, reloadOnChange: true) \/\/ \u52a0\u8f7d appsettings.json \u6587\u4ef6\n    .AddEnvironmentVariables() \/\/ \u53ef\u4ee5\u6dfb\u52a0\u73af\u5883\u53d8\u91cf\u7684\u914d\u7f6e\n    .AddCommandLine(args) \/\/ \u53ef\u4ee5\u6dfb\u52a0\u547d\u4ee4\u884c\u53c2\u6570\u7684\u914d\u7f6e\n    .Build();<\/code><\/pre>\n<\/li>\n<li>\u7136\u540e\u6784\u9020\u4e00\u4e2aDbContext<br \/>\n<mark>\u5e73\u65f6\u90fd\u662fweb api\u9879\u76ee\u91cc\u6ce8\u5165\uff0cConsole\u5dee\u70b9\u4e0d\u4f1a\u5199\u2026\u2026<\/mark><\/p>\n<pre><code class=\"language-C#\">\/\/\u914d\u7f6eDbContext\nEFCoreQueryHelper.Configuration = configuration;\nstring constr = &quot;Default&quot;;\nDbContextOptionsBuilder&lt;EFCoreSampleDbContext&gt; optionsBuilder = new DbContextOptionsBuilder&lt;EFCoreSampleDbContext&gt;\n();\noptionsBuilder.UseSqlServer(configuration.GetConnectionString(constr));\nusing EFCoreSampleDbContext dbContext = new EFCoreSampleDbContext(optionsBuilder.Options);<\/code><\/pre>\n<\/li>\n<li>\u518d\u6267\u884c\u8fc1\u79fb\u53ca\u79cd\u5b50\u6570\u636e\n<pre><code class=\"language-C#\">\/\/\u81ea\u52a8\u8fc1\u79fb\nif (dbContext.Database.GetPendingMigrations().Any())\ndbContext.Database.Migrate();\n\/\/\u79cd\u5b50\u6570\u636e\nvoid AddSeedData()\n{\nif (dbContext.TestModels.Any(t =&gt; t.Id == 1))\n    return;\nfor (var i = 1; i &lt; 100; i++)\n{\n    TestModel testModel = new TestModel()\n    {\n        \/\/Id = i,\n        S = &quot;S&quot; + i.ToString(),\n        L = i,\n        B = i % 2 == 0 ? true : false,\n        D = i,\n        F = i,\n        G = Guid.NewGuid(),\n        CreateDate = DateTime.Now\n    };\n    dbContext.Add(testModel);\n}\ndbContext.SaveChanges();\n}\nAddSeedData();<\/code><\/pre>\n<\/li>\n<\/ul>\n<p>\u6d4b\u8bd5\u73af\u5883\u5df2\u51c6\u5907\u597d\uff0c\u4e0b\u9762\u8fdb\u5165\u6b63\u9898\uff0c\u8be5\u5982\u4f55\u4f7f\u7528\u3002<\/p>\n<h2>\u5982\u4f55\u9632SQL\u6ce8\u5165<\/h2>\n<p>\u9632SQL\u6ce8\u5165\u7684\u6838\u5fc3\uff0c\u662f\u4f7f\u7528<code>FormattableString<\/code>\uff0c\u4ece\u4e2d\u63d0\u53d6\u683c\u5f0f\u5316\u7684\u5b57\u7b26\u4e32\uff0c\u53ca\u5176\u53c2\u6570\u53d8\u91cf\uff0c\u4ece\u800c\u8f6c\u6362\u4e3aSqlParameter[]\uff0c\u5728ado.net\u91cc\u6267\u884c\u3002<\/p>\n<h3>\u4f7f\u7528<code>FormattableString<\/code><\/h3>\n<ul>\n<li>\u65b9\u6cd5\u540d\u5e26Interpolated\u540e\u7f00\u7684\uff0c\u90fd\u662f\u9632SQL\u6ce8\u5165\n<pre><code class=\"language-C#\">\/\/\u67e5\u8be2\u793a\u4f8b\nConsole.WriteLine(&quot;\u9632\u6ce8\u5165:&quot;);\nList&lt;TestModel&gt; full = dbContext.SqlQueryDynamicInterpolated&lt;TestModel&gt;($&quot;select * from TestModel where id = {id}&quot;);\nConsole.WriteLine(&quot;full:&quot;);\nConsole.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(full));\nConsole.WriteLine();\n\/\/\u90e8\u5206\u5b57\u6bb5\nList&lt;TestModel&gt; part = dbContext.SqlQueryDynamicInterpolated&lt;TestModel&gt;($&quot;select S from TestModel where id = {id}&quot;);\nConsole.WriteLine(&quot;part:&quot;);\nConsole.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(part));\nConsole.WriteLine();\n\/\/\u52a8\u6001\u5bf9\u8c61\uff0c\u672c\u8d28\u662fExpandoObject\nIEnumerable&lt;dynamic&gt; dyn = dbContext.SqlQueryDynamicInterpolated($&quot;select S from TestModel where id = {id}&quot;);\nConsole.WriteLine(&quot;dyn:&quot;);\nConsole.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(dyn));\nConsole.WriteLine();<\/code><\/pre>\n<\/li>\n<li>\u8981\u6ce8\u610f\u533a\u5206<code>FormattableString<\/code>($&quot;&quot;)\u548c<code>string<\/code>(&quot;&quot;)\u7684\u4f7f\u7528<br \/>\n\u4e0b\u9762\u65b9\u6cd5\u4e0d\u5e26Interpolated\uff0c\u867d\u7136\u4e5f\u662f\u7528\u4e86<code>FormattableString<\/code>\uff0c\u4f46\u5b83\u6700\u7ec8\u4f1a\u662f<code>string<\/code>\uff0c\u6ca1\u6cd5\u9632SQL\u6ce8\u5165\u3002<br \/>\n\u5728\u4f20\u7edf\u7684ado.net\u4e2d\uff0c\u4e0b\u9762\u7684{id}\u5e94\u8be5\u6539\u4e3a@p0\uff0c\u53c2\u6570\u5316\u624d\u80fd\u9632SQL\u6ce8\u5165\u3002<\/p>\n<pre><code class=\"language-C#\">\/\/\u4ee5\u4e0b\u662f\u7eaf\u7cb9\u7684\u62fc\u63a5\u5b57\u7b26\u4e32\uff0c\u4e0d\u80fd\u9632Sql\u6ce8\u5165\uff0c\u4e0d\u63a8\u8350\nfull = dbContext.SqlQueryDynamic&lt;TestModel&gt;($&quot;select * from TestModel where id = {id}&quot;, new SqlParameter[] { });\nConsole.WriteLine(&quot;\u4e0d\u9632\u6ce8\u5165:&quot;);\nConsole.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(full));\nConsole.WriteLine();<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>\u4f7f\u7528<code>SqlFormatter<\/code><\/h3>\n<p><code>$&quot;&quot;<\/code> \u7684\u7f3a\u70b9\u662f\u4e0d\u80fd\u62fc\u63a5\u5982<code>$&quot;&quot; + $&quot;&quot;<\/code>\uff0c\u5b83\u4f1a\u53d8\u4e3a<code>string<\/code>\uff0c\u5bfc\u81f4\u4e0d\u80fd\u9632SQL\u6ce8\u5165\u3002<br \/>\n\u6b64\u65f6\u9700\u8981\u60f3StringBuilder\u4e00\u6837\uff0c\u5c01\u88c5\u4e00\u4e2a\u53ef\u4ee5Append\u5b57\u7b26\u4e32\u7684\u7c7b\u3002<\/p>\n<pre><code class=\"language-C#\">SqlFormatter sqlFormatter = new SqlFormatter(&quot;select * from TestModel where 1=1 &quot;);\n\/\/\u53c2\u6570\u5316\u6761\u4ef6\nif (true)\n    sqlFormatter.AppendLine_FmtStr($&quot;and id = {id}&quot;);\n\/\/\u4e0d\u9700\u8981\u53c2\u6570\u5316\u7684\u6761\u4ef6\nif (true)\n    sqlFormatter.AppendLine_Str(&quot;and S = &#039;S1&#039;&quot;);\n\/\/\u4e3b\u8981\u770b{}\uff0c\u8fd9\u4e5f\u662f\u53c2\u6570\u5316\nif (true)\n    sqlFormatter.AppendLine_FmtStr($&quot;and S = {&quot;S&quot; + id}&quot;);\nsqlFormatter.AppendLine_FmtStr($&quot;or L = {2}&quot;);\nsqlFormatter.AppendLine_FmtStr($&quot;or F = {3}&quot;);\nsqlFormatter.AppendLine_FmtStr($&quot;or D = {4}&quot;);\nsqlFormatter.AppendLine_FmtStr($&quot;or (B = {false} and id in (5,7,9) )&quot;);\nConsole.WriteLine(sqlFormatter.FormatedSql);\nfull = dbContext.SqlQueryDynamic&lt;TestModel&gt;(sqlFormatter.FormatedSql, sqlFormatter.Parameters);\nConsole.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(full));\nConsole.WriteLine();<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230<code>sqlFormatter.FormatedSql<\/code>\u4e2d\u5df2\u7ecf\u5c06{p}\u8f6c\u5316\u4e3a@p\u3002<\/p>\n<h3>\u4f7f\u7528<code>SqlPaging<\/code><\/h3>\n<p>\u62a5\u8868\u5f00\u53d1\u4e2d\u7528\u7684\u6700\u591a\u7684\u5f53\u7136\u662f\u5206\u9875\u4e86\uff0c\u7ed3\u5408<code>SqlFormatter<\/code>\u3001<code>SqlPaging<\/code>\u3001<code>PagingUtil<\/code>\uff0c\u5b9e\u73b0\u5206\u9875\u67e5\u8be2\u3002<\/p>\n<pre><code class=\"language-C#\">\/\/\u5206\u9875\u4f8b\u5b50\nConsole.WriteLine(&quot;SqlPaging\u5206\u9875:&quot;);\n\/\/\u5148\u6784\u5efa\u6761\u4ef6\uff0c\u7ea6\u7b49\u4e8eid\u4e3a\u5947\u6570\u7684\u6570\u636e\nsqlFormatter = new SqlFormatter();\nsqlFormatter.AppendLine_FmtStr($&quot;and t.B = {false}&quot;);\n\n\/\/\u9664\u4e86\u7b49\u53f7\u9017\u53f7\uff0c\u5199\u6cd5\u57fa\u672c\u4e0esql\u8bed\u53e5\u4e00\u81f4\nSqlPaging sqlPaging = new SqlPaging()\n{\n    db = dbContext,\n    Select = &quot;*&quot;,\n    From = &quot;TestModel t&quot;,\n    WhereBuilder = sqlFormatter,\n    OrderBy = &quot; t.id desc&quot;\n};\n\n\/\/\u6bcf\u987510\u6761\nfull = sqlPaging.Execute&lt;TestModel&gt;();\nConsole.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(sqlPaging.PagingUtil));\nConsole.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(full));\nConsole.WriteLine();\n\n\/\/\u6bcf\u98755\u6761\uff0c\u7b2c\u4e09\u9875\nsqlPaging.PagingUtil.PageSize = 5;\nsqlPaging.PagingUtil.PageIdx = 3;\nfull = sqlPaging.Execute&lt;TestModel&gt;();\nConsole.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(sqlPaging.PagingUtil));\nConsole.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(full));\nConsole.WriteLine();<\/code><\/pre>\n<h2>EF\u3001SqlSugar\u3001Dapper\u5bf9\u6bd4<\/h2>\n<p>\u9664\u4e86\u5f00\u59cb\u4e0d\u77e5\u9053\u540e\u9762\u4e24\u4e2a\u5916\uff0c\u6211\u559c\u6b22EF\u7684Migration\u529f\u80fd\uff0c\u5b83\u6bd4SqlSugar\u5f3a\u3002<br \/>\n\u800c\u4e14\u4f7f\u7528EF\uff0c\u663e\u5f97\u76f8\u5f53\u6e05\u771f\uff0c\u5b83\u53c8\u662f\u6211\u81ea\u5df1\u5199\uff0c\u81ea\u5df1\u7528\u7684\u7c7b\u5e93\uff0c\u5b83\u4e0d\u9700\u8981\u5b83\u590d\u6742\u7684\u529f\u80fd\uff0c\u6ee1\u8db3\u6211\u65e5\u5e38\u4f7f\u7528\u5373\u53ef\u3002<br \/>\n\u53cd\u5c04\u65b9\u9762\u7684\u6027\u80fd\u6ca1\u6709\u5bf9\u6bd4\uff0c\u6682\u7565\u3002<\/p>\n<h2>\u5176\u4ed6<\/h2>\n<p>\u65e2\u7136\u662f\u8001\u6d3eSQL\uff0c\u5f53\u7136\u5c11\u4e0d\u4e86DbFirst\u3002<br \/>\n\u540e\u7eed\u8865\u5145DbFirst\u8f6cCodeFirst\u5f00\u53d1\u6a21\u5f0f\u3002<br \/>\nTo Be Continue...<\/p>\n<h2>Author Info<\/h2>\n<p>DimWalker<br \/>\n\u00a92023 \u5e7f\u5dde\u5e02\u589e\u57ce\u533a\u9eef\u5f71\u4fe1\u606f\u79d1\u6280\u90e8<br \/>\n<a href=\"https:\/\/www.dimtechstudio.com\/\">https:\/\/www.dimtechstudio.com\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"Wlkr.Core.EFCore \u9006\u5929\uff0c\u6211\u5728ef core\u4e2d\u4f7f\u7528ado.net\uff01 \u8001\u6d3eSql\u4e4b\u5fc5\u8981 \u5f53\u4f60\u5f00\u53d1\u751f\u6daf\u4e2d\u57fa\u672c\u53ea\u7528\u4e00\u4e24\u79cd\u6570\u636e\u5e93 \u5f53\u4f60\u89c9\u5f97\u7528EF\u7684\u7c7b\u5199\u62a5\u8868\u65f6\u5f88\u522b\u626d \u5f53\u4f60\u89c9\u81ea\u5df1\u7684Sql( Serv &#8230;","protected":false},"author":1,"featured_media":14,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[22,21,20],"class_list":["post-33","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-3","tag-efcore","tag-orm","tag-sqlserver"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u8001\u6d3eSql\u4e4b\u5fc5\u8981 - \u9eef\u5f71\u4fe1\u606f\u79d1\u6280\u90e8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/\u8001\u6d3esql\u4e4b\u5fc5\u8981\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u8001\u6d3eSql\u4e4b\u5fc5\u8981 - \u9eef\u5f71\u4fe1\u606f\u79d1\u6280\u90e8\" \/>\n<meta property=\"og:description\" content=\"Wlkr.Core.EFCore \u9006\u5929\uff0c\u6211\u5728ef core\u4e2d\u4f7f\u7528ado.net\uff01 \u8001\u6d3eSql\u4e4b\u5fc5\u8981 \u5f53\u4f60\u5f00\u53d1\u751f\u6daf\u4e2d\u57fa\u672c\u53ea\u7528\u4e00\u4e24\u79cd\u6570\u636e\u5e93 \u5f53\u4f60\u89c9\u5f97\u7528EF\u7684\u7c7b\u5199\u62a5\u8868\u65f6\u5f88\u522b\u626d \u5f53\u4f60\u89c9\u81ea\u5df1\u7684Sql( Serv ...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/\u8001\u6d3esql\u4e4b\u5fc5\u8981\/\" \/>\n<meta property=\"og:site_name\" content=\"\u9eef\u5f71\u4fe1\u606f\u79d1\u6280\u90e8\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-24T06:29:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-25T10:38:30+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/dimtechstudio.com\/wp-content\/uploads\/2023\/11\/DimTechStudio-Logo-220x150-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"220\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"DimWalker\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"DimWalker\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/\"},\"author\":{\"name\":\"DimWalker\",\"@id\":\"https:\/\/dimtechstudio.com\/#\/schema\/person\/7f8c70f133a3ce4b0c308884bbbd83a8\"},\"headline\":\"\u8001\u6d3eSql\u4e4b\u5fc5\u8981\",\"datePublished\":\"2023-11-24T06:29:13+00:00\",\"dateModified\":\"2023-11-25T10:38:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/\"},\"wordCount\":99,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/dimtechstudio.com\/#\/schema\/person\/7f8c70f133a3ce4b0c308884bbbd83a8\"},\"keywords\":[\"EFCore\",\"ORM\",\"SqlServer\"],\"articleSection\":[\"\u539f\u521b\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/\",\"url\":\"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/\",\"name\":\"\u8001\u6d3eSql\u4e4b\u5fc5\u8981 - \u9eef\u5f71\u4fe1\u606f\u79d1\u6280\u90e8\",\"isPartOf\":{\"@id\":\"https:\/\/dimtechstudio.com\/#website\"},\"datePublished\":\"2023-11-24T06:29:13+00:00\",\"dateModified\":\"2023-11-25T10:38:30+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/dimtechstudio.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u8001\u6d3eSql\u4e4b\u5fc5\u8981\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dimtechstudio.com\/#website\",\"url\":\"https:\/\/dimtechstudio.com\/\",\"name\":\"\u9eef\u5f71\u4fe1\u606f\u79d1\u6280\u90e8\",\"description\":\"DimTechStudio\",\"publisher\":{\"@id\":\"https:\/\/dimtechstudio.com\/#\/schema\/person\/7f8c70f133a3ce4b0c308884bbbd83a8\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dimtechstudio.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/dimtechstudio.com\/#\/schema\/person\/7f8c70f133a3ce4b0c308884bbbd83a8\",\"name\":\"DimWalker\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/dimtechstudio.com\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/dimtechstudio.com\/wp-content\/uploads\/2023\/11\/DimTechStudio-Icon-128x128-1.png\",\"contentUrl\":\"http:\/\/dimtechstudio.com\/wp-content\/uploads\/2023\/11\/DimTechStudio-Icon-128x128-1.png\",\"width\":128,\"height\":128,\"caption\":\"DimWalker\"},\"logo\":{\"@id\":\"https:\/\/dimtechstudio.com\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/dimtechstudio.com\"],\"url\":\"http:\/\/dimtechstudio.com\/index.php\/author\/walker\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u8001\u6d3eSql\u4e4b\u5fc5\u8981 - \u9eef\u5f71\u4fe1\u606f\u79d1\u6280\u90e8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/\u8001\u6d3esql\u4e4b\u5fc5\u8981\/","og_locale":"zh_CN","og_type":"article","og_title":"\u8001\u6d3eSql\u4e4b\u5fc5\u8981 - \u9eef\u5f71\u4fe1\u606f\u79d1\u6280\u90e8","og_description":"Wlkr.Core.EFCore \u9006\u5929\uff0c\u6211\u5728ef core\u4e2d\u4f7f\u7528ado.net\uff01 \u8001\u6d3eSql\u4e4b\u5fc5\u8981 \u5f53\u4f60\u5f00\u53d1\u751f\u6daf\u4e2d\u57fa\u672c\u53ea\u7528\u4e00\u4e24\u79cd\u6570\u636e\u5e93 \u5f53\u4f60\u89c9\u5f97\u7528EF\u7684\u7c7b\u5199\u62a5\u8868\u65f6\u5f88\u522b\u626d \u5f53\u4f60\u89c9\u81ea\u5df1\u7684Sql( Serv ...","og_url":"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/\u8001\u6d3esql\u4e4b\u5fc5\u8981\/","og_site_name":"\u9eef\u5f71\u4fe1\u606f\u79d1\u6280\u90e8","article_published_time":"2023-11-24T06:29:13+00:00","article_modified_time":"2023-11-25T10:38:30+00:00","og_image":[{"width":220,"height":150,"url":"http:\/\/dimtechstudio.com\/wp-content\/uploads\/2023\/11\/DimTechStudio-Logo-220x150-1.png","type":"image\/png"}],"author":"DimWalker","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"DimWalker","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/#article","isPartOf":{"@id":"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/"},"author":{"name":"DimWalker","@id":"https:\/\/dimtechstudio.com\/#\/schema\/person\/7f8c70f133a3ce4b0c308884bbbd83a8"},"headline":"\u8001\u6d3eSql\u4e4b\u5fc5\u8981","datePublished":"2023-11-24T06:29:13+00:00","dateModified":"2023-11-25T10:38:30+00:00","mainEntityOfPage":{"@id":"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/"},"wordCount":99,"commentCount":0,"publisher":{"@id":"https:\/\/dimtechstudio.com\/#\/schema\/person\/7f8c70f133a3ce4b0c308884bbbd83a8"},"keywords":["EFCore","ORM","SqlServer"],"articleSection":["\u539f\u521b"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/","url":"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/","name":"\u8001\u6d3eSql\u4e4b\u5fc5\u8981 - \u9eef\u5f71\u4fe1\u606f\u79d1\u6280\u90e8","isPartOf":{"@id":"https:\/\/dimtechstudio.com\/#website"},"datePublished":"2023-11-24T06:29:13+00:00","dateModified":"2023-11-25T10:38:30+00:00","breadcrumb":{"@id":"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/dimtechstudio.com\/index.php\/2023\/11\/24\/%e8%80%81%e6%b4%besql%e4%b9%8b%e5%bf%85%e8%a6%81\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/dimtechstudio.com\/"},{"@type":"ListItem","position":2,"name":"\u8001\u6d3eSql\u4e4b\u5fc5\u8981"}]},{"@type":"WebSite","@id":"https:\/\/dimtechstudio.com\/#website","url":"https:\/\/dimtechstudio.com\/","name":"\u9eef\u5f71\u4fe1\u606f\u79d1\u6280\u90e8","description":"DimTechStudio","publisher":{"@id":"https:\/\/dimtechstudio.com\/#\/schema\/person\/7f8c70f133a3ce4b0c308884bbbd83a8"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dimtechstudio.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/dimtechstudio.com\/#\/schema\/person\/7f8c70f133a3ce4b0c308884bbbd83a8","name":"DimWalker","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/dimtechstudio.com\/#\/schema\/person\/image\/","url":"http:\/\/dimtechstudio.com\/wp-content\/uploads\/2023\/11\/DimTechStudio-Icon-128x128-1.png","contentUrl":"http:\/\/dimtechstudio.com\/wp-content\/uploads\/2023\/11\/DimTechStudio-Icon-128x128-1.png","width":128,"height":128,"caption":"DimWalker"},"logo":{"@id":"https:\/\/dimtechstudio.com\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/dimtechstudio.com"],"url":"http:\/\/dimtechstudio.com\/index.php\/author\/walker\/"}]}},"_links":{"self":[{"href":"http:\/\/dimtechstudio.com\/index.php\/wp-json\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/dimtechstudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/dimtechstudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/dimtechstudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/dimtechstudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=33"}],"version-history":[{"count":0,"href":"http:\/\/dimtechstudio.com\/index.php\/wp-json\/wp\/v2\/posts\/33\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/dimtechstudio.com\/index.php\/wp-json\/wp\/v2\/media\/14"}],"wp:attachment":[{"href":"http:\/\/dimtechstudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/dimtechstudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/dimtechstudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}