You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
13 KiB
JavaScript

1 year ago
"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[3021],{514:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>o,contentTitle:()=>a,default:()=>l,frontMatter:()=>u,metadata:()=>d,toc:()=>c});var t=n(5893),s=n(1151);const u={id:"dbcontext-add-or-update",title:"9.8 \u65b0\u589e\u6216\u66f4\u65b0\u64cd\u4f5c",sidebar_label:"9.8 \u65b0\u589e\u6216\u66f4\u65b0\u64cd\u4f5c"},a=void 0,d={id:"dbcontext-add-or-update",title:"9.8 \u65b0\u589e\u6216\u66f4\u65b0\u64cd\u4f5c",description:"\u4ee5\u4e0b\u5185\u5bb9\u5728 Furion 2.5.1 + \u7248\u672c\u4e2d\u5df2\u79fb\u9664\u3002\u6b64\u64cd\u4f5c\u8ba9\u5f88\u591a\u4e0d\u4e86\u89e3 EFCore \u7684\u5f00\u53d1\u8005\u4ea7\u751f\u4e86\u5f88\u5927\u7684\u8bef\u89e3\uff0c\u4e0d\u77e5\u4f55\u65f6\u65b0\u589e\u6216\u4f55\u65f6\u66f4\u65b0\uff0c\u6545\u79fb\u9664\u6b64\u529f\u80fd\u3002",source:"@site/docs/dbcontext-add-or-update.mdx",sourceDirName:".",slug:"/dbcontext-add-or-update",permalink:"/docs/dbcontext-add-or-update",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/dbcontext-add-or-update.mdx",tags:[],version:"current",lastUpdatedBy:"MonkSoul",lastUpdatedAt:1682389320,formattedLastUpdatedAt:"Apr 25, 2023",frontMatter:{id:"dbcontext-add-or-update",title:"9.8 \u65b0\u589e\u6216\u66f4\u65b0\u64cd\u4f5c",sidebar_label:"9.8 \u65b0\u589e\u6216\u66f4\u65b0\u64cd\u4f5c"},sidebar:"docs",previous:{title:"9.7 \u66f4\u65b0\u64cd\u4f5c",permalink:"/docs/dbcontext-update"},next:{title:"9.9 \u5220\u9664\u64cd\u4f5c",permalink:"/docs/dbcontext-delete"}},o={},c=[{value:"9.8.1 \u65b0\u589e\u6216\u66f4\u65b0\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09",id:"981-\u65b0\u589e\u6216\u66f4\u65b0\u4e0d\u7acb\u5373\u63d0\u4ea4",level:2},{value:"9.8.2 \u65b0\u589e\u6216\u66f4\u65b0\uff08\u7acb\u5373\u63d0\u4ea4\uff09",id:"982-\u65b0\u589e\u6216\u66f4\u65b0\u7acb\u5373\u63d0\u4ea4",level:2},{value:"9.8.3 \u65b0\u589e\u6216\u66f4\u65b0\u90e8\u5206\u5217\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09",id:"983-\u65b0\u589e\u6216\u66f4\u65b0\u90e8\u5206\u5217\u4e0d\u7acb\u5373\u63d0\u4ea4",level:2},{value:"9.8.4 \u65b0\u589e\u6216\u66f4\u65b0\u90e8\u5206\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09",id:"984-\u65b0\u589e\u6216\u66f4\u65b0\u90e8\u5206\u5217\u7acb\u5373\u63d0\u4ea4",level:2},{value:"9.8.5 \u65b0\u589e\u6216\u66f4\u65b0\u6392\u9664\u7279\u5b9a\u5217\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09",id:"985-\u65b0\u589e\u6216\u66f4\u65b0\u6392\u9664\u7279\u5b9a\u5217\u4e0d\u7acb\u5373\u63d0\u4ea4",level:2},{value:"9.8.6 \u65b0\u589e\u6216\u66f4\u65b0\u6392\u9664\u7279\u5b9a\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09",id:"986-\u65b0\u589e\u6216\u66f4\u65b0\u6392\u9664\u7279\u5b9a\u5217\u7acb\u5373\u63d0\u4ea4",level:2},{value:"9.8.7 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"987-\u53cd\u9988\u4e0e\u5efa\u8bae",level:2}];function i(e){const r={a:"a",admonition:"admonition",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.admonition,{title:"\u529f\u80fd\u79fb\u9664\u58f0\u660e",type:"warning",children:(0,t.jsxs)(r.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u5728 ",(0,t.jsx)(r.code,{children:"Furion 2.5.1 +"})," \u7248\u672c\u4e2d\u5df2\u79fb\u9664\u3002\u6b64\u64cd\u4f5c\u8ba9\u5f88\u591a\u4e0d\u4e86\u89e3 ",(0,t.jsx)(r.code,{children:"EFCore"})," \u7684\u5f00\u53d1\u8005\u4ea7\u751f\u4e86\u5f88\u5927\u7684\u8bef\u89e3\uff0c\u4e0d\u77e5\u4f55\u65f6\u65b0\u589e\u6216\u4f55\u65f6\u66f4\u65b0\uff0c\u6545\u79fb\u9664\u6b64\u529f\u80fd\u3002"]})}),"\n",(0,t.jsx)(r.h2,{id:"981-\u65b0\u589e\u6216\u66f4\u65b0\u4e0d\u7acb\u5373\u63d0\u4ea4",children:"9.8.1 \u65b0\u589e\u6216\u66f4\u65b0\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-cs",metastring:"showLineNumbers",children:"// ==== \u540c\u6b65\u64cd\u4f5c ====\r\n\r\n// \u793a\u4f8b\u4e00\r\nrepository.InsertOrUpdate(user);\r\n\r\n// \u793a\u4f8b\u4e8c\r\nuser.InsertOrUpdate();\r\n\r\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\r\n\r\n// \u793a\u4f8b\u4e00\r\nawait repository.InsertOrUpdateAsync(user);\r\n\r\n// \u793a\