{"id":167125,"date":"2020-10-08T16:33:27","date_gmt":"2020-10-08T08:33:27","guid":{"rendered":"http:\/\/4563.org\/?p=167125"},"modified":"2020-10-08T16:33:27","modified_gmt":"2020-10-08T08:33:27","slug":"%e7%b3%bb%e7%bb%9f%e8%bf%81%e7%a7%bb-netcore-%e6%b1%82%e8%a7%a3","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=167125","title":{"rendered":"\u7cfb\u7edf\u8fc1\u79fb.netCore \u6c42\u89e3"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u7cfb\u7edf\u8fc1\u79fb.netCore \u6c42\u89e3               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : skyworker <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u524d\u63d0: \u6211\u4eec\u56e2\u961f\u7684\u6280\u672f\u6808\u662f:antd+laravel, \u4eca\u5e74\u63a5\u4e86\u4e00\u4e2a\u4f01\u4e1a\u7684\u5185\u90e8\u5b9a\u5236\u4e1a\u52a1\u7cfb\u7edf, \u5bf9\u65b9\u7684 IT \u8d1f\u8d23\u4eba\u662f.net \u51fa\u8eab, \u8981\u6c42\u540e\u53f0\u7528.net \u6765\u5b9e\u73b0,\u4fbf\u4e8e\u4ed6\u4eec\u540e\u671f\u505a\u5c0f\u8303\u56f4\u4e1a\u52a1\u8c03\u6574. <\/p>\n<p>\u4e3a\u4e86\u5c3d\u5feb\u642d\u5efa\u8f6f\u4ef6\u6a21\u578b, \u56e2\u961f\u521d\u671f\u4ecd\u7136\u6309\u7167 antd+laravel \u5feb\u901f\u642d\u5efa\u5e73\u53f0, \u8003\u8651\u4e1a\u52a1\u7a33\u5b9a\u6210\u578b\u540e,\u540e\u53f0\u8fc1\u79fb\u4e3a.netCore. \u76ee\u524d\u4e1a\u52a1\u903b\u8f91\u5df2\u7ecf\u5b8c\u6210\u4e86, \u672c\u6765\u4ee5\u4e3a laravel \u540e\u53f0\u8f6c netCore \u4f1a\u5f88\u7b80\u5355, \u6ca1\u60f3\u5230\u5dee\u522b\u8fd8\u6bd4\u8f83\u5927.<\/p>\n<p>\u4f8b\u5982\u67d0\u4e2a\u4e1a\u52a1 form \u4e2d, \u6709\u5982\u4e0b\u5b57\u6bb5:<\/p>\n<p>\u603b\u4ea7\u91cf<br \/>\u65e9\u73ed 1 \u53f7\u4e95\u91cf<br \/>\u4e2d\u73ed 1 \u53f7\u4e95\u91cf<br \/>\u665a\u73ed 1 \u53f7\u4e95\u91cf<br \/>\u65e9\u73ed 2 \u53f7\u4e95\u91cf<br \/>&#8230;.<\/p>\n<p>\u4f8b\u5982\u6709 40 \u4e2a field \u5427, \u5728 laravel CRUD \u90fd\u5f88\u7b80\u5355,<\/p>\n<p>\/\/ \u65b0\u589e<br \/>$data = $request-&gt;all();<br \/>$chanliang = new Chanliang($data);<br \/>$chanliang-&gt;save();<\/p>\n<p>\/\/ \u4fee\u6539 <br \/>\/\/ $request \u4e2d\u4f20\u4e86\u51e0\u4e2a\u5b57\u6bb5, modal \u5c31\u53ea\u4fee\u6539\u51e0\u4e2a\u5b57\u6bb5<br \/>$data = $request-&gt;all();<br \/>$changliang = Chanliang::find($id);<br \/>$changliang-&gt;update($data);<\/p>\n<p>\u4f46\u662f\u5728 netCore \u4e2d, \u65b0\u589e\u8fd8\u597d\u8bf4, \u5728\u4fee\u6539\u7684\u65f6\u5019, \u5982\u679c\u8fd9 40 \u4e2a\u5b57\u6bb5\u4e2d, \u5ba2\u6237\u53ea\u4fee\u6539\u4e86 3 \u4e2a(post \u4e2d\u4e5f\u53ea\u5305\u542b\u8fd9\u4e09\u4e2a\u5b57\u6bb5),\u5176\u4ed6\u7684\u90fd\u4f1a\u88ab\u81ea\u52a8\u6e05\u7a7a.<\/p>\n<p>\u67e5\u4e86\u4e00\u4e9b\u8d44\u6599, netCore \u4e2d\u597d\u50cf\u5e76\u4e0d\u652f\u6301\u76ee\u524d\u73b0\u6709\u7684\u4fee\u6539\u65b9\u6cd5(antd \u524d\u7aef\u518d\u505a\u8c03\u6574\u6210\u672c\u592a\u9ad8), \u6709\u6ca1\u6709\u505a\u8fc7\u7c7b\u4f3c\u7684\u5de5\u4f5c?      <\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>6<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3692741\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : a194259440 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709\u70b9\u6ca1\u770b\u61c2\uff0c\u9898\u4e3b\u7684\u610f\u601d\u662f\uff0c\u8c03\u7528\u63a5\u53e3\u65f6\uff0c\u53ea\u4f20\u5165\u4e86\u4e09\u4e2a\u5b57\u6bb5\uff0c\u5c31\u5bfc\u81f4\u5176\u5b83\u5b57\u6bb5\u5168\u90e8\u6e05\u7a7a\uff0c\u53ea\u6709\u8fd9\u4e09\u4e2a\u5b57\u6bb5\u6709\u503c\u4e48\uff1f<br \/>\u5982\u679c\u662f\u8fd9\u6837\uff0c\u90a3\u5c31\u662f\u63a5\u53e3\u91cc\u9762\u7684 CRUD \u6709\u95ee\u9898\uff0c\u4fee\u6539\u63a5\u53e3\u5c31\u597d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3692742\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jtwor <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8981\u4e48\u5224\u7a7a \u7a7a\u5c31\u4e0d\u66f4\u65b0 \u8981\u4e48\u6574\u4e2a form \u63d0\u4ea4 \u4e0d\u8981\u4fee\u6539\u4e09\u4e2a\u5c31\u63d0\u4ea4\u4e09\u4e2a\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3692743\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : alshlg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5b57\u6bb5\u503c\u90fd\u4f20\u8fc7\u53bb update\uff0c\u4e0d\u7ba1\u6709\u6ca1\u6709\u4fee\u6539                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3692744\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : PerFectTime <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u4e2a\u5f97\u770b\u4f60\u7528\u4ec0\u4e48\u6570\u636e\u5c42\u7684\u5427\uff0c\u5982\u679c\u4f60\u7528\u7684 EF\uff0c\u4ed6\u4f1a\u81ea\u52a8\u5ffd\u7565\u503c\u4e3a NULL \u7684\u5c5e\u6027\u4e0d\u505a\u66f4\u65b0                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3692745\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : grzhan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5982\u679c\u662f\u7528 .Net Core \u7684\u8bdd\uff0c\u5bf9\u5e94\u7684 ORM \u53ef\u80fd\u7528\u7684\u662f EF Core \uff1f<br \/>\u5982\u679c\u662f EF Core \u7684\u8bdd\uff0c\u53ef\u4ee5\u7b80\u5355\u53c2\u8003\u8fd9\u7bc7\uff08 https:\/\/www.cnblogs.com\/cgzl\/p\/8543772.html \uff09<br \/>\u66f4\u65b0\u5c31\u76f4\u63a5\u662f\u8ffd\u8e2a Model \u7684\u5c5e\u6027\uff0c\u66f4\u65b0\u5c5e\u6027\u5e76 SaveChange \u4e4b\u540e\u5c31\u4f1a\u5b9e\u73b0\u5b57\u6bb5\u7684\u66f4\u65b0\uff08 https:\/\/images2018.cnblogs.com\/blog\/986268\/201803\/986268-20180311220651540-1228571595.png \uff09                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3692746\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dswyzx <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8bf4\u5177\u4f53\u7684\u6846\u67b6\u7ec6\u8282\u5427,\u6700\u7ec8\u662f orm \u751f\u6210\u7684\u6267\u884c\u8bed\u53e5\u4e0e db \u4ea4\u4e92\u7684,\u8fd9\u4e2a\u4ea4\u4e92\u7ed3\u679c\u4e0d\u7b26\u5408\u9884\u671f,\u6539\u5457                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u7cfb\u7edf\u8fc1\u79fb.netCore \u6c42\u89e3 \u8cc7&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/167125"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=167125"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/167125\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=167125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=167125"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=167125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}