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
12 KiB
JavaScript

12 months ago
"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[2710],{9801:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var t=r(5893),s=r(1151);const i={id:"dbcontext-delete",title:"9.9 \u5220\u9664\u64cd\u4f5c",sidebar_label:"9.9 \u5220\u9664\u64cd\u4f5c"},o=void 0,l={id:"dbcontext-delete",title:"9.9 \u5220\u9664\u64cd\u4f5c",description:"\u4ee5\u4e0b\u5185\u5bb9\u5305\u542b Exists \u5355\u8bcd\u7684\u5728 Furion 2.6.0 + \u7248\u672c\u4e2d\u5df2\u79fb\u9664\u3002",source:"@site/docs/dbcontext-delete.mdx",sourceDirName:".",slug:"/dbcontext-delete",permalink:"/docs/dbcontext-delete",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/dbcontext-delete.mdx",tags:[],version:"current",lastUpdatedBy:"\u767e\u5c0f\u50e7",lastUpdatedAt:1700736899,formattedLastUpdatedAt:"Nov 23, 2023",frontMatter:{id:"dbcontext-delete",title:"9.9 \u5220\u9664\u64cd\u4f5c",sidebar_label:"9.9 \u5220\u9664\u64cd\u4f5c"},sidebar:"docs",previous:{title:"9.8 \u65b0\u589e\u6216\u66f4\u65b0\u64cd\u4f5c",permalink:"/docs/dbcontext-add-or-update"},next:{title:"9.10 \u6279\u91cf\u64cd\u4f5c",permalink:"/docs/dbcontext-batch"}},a={},d=[{value:"9.9.1 \u5220\u9664\u4e00\u4e2a\u5b9e\u4f53\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09",id:"991-\u5220\u9664\u4e00\u4e2a\u5b9e\u4f53\u4e0d\u7acb\u5373\u63d0\u4ea4",level:2},{value:"9.9.2 \u5220\u9664\u4e00\u4e2a\u5b9e\u4f53\uff08\u7acb\u5373\u63d0\u4ea4\uff09",id:"992-\u5220\u9664\u4e00\u4e2a\u5b9e\u4f53\u7acb\u5373\u63d0\u4ea4",level:2},{value:"9.9.3 \u6839\u636e\u4e3b\u952e\u5220\u9664\u8bb0\u5f55\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09",id:"993-\u6839\u636e\u4e3b\u952e\u5220\u9664\u8bb0\u5f55\u4e0d\u7acb\u5373\u63d0\u4ea4",level:2},{value:"9.9.4 \u6839\u636e\u4e3b\u952e\u5220\u9664\u8bb0\u5f55\uff08\u7acb\u5373\u63d0\u4ea4\uff09",id:"994-\u6839\u636e\u4e3b\u952e\u5220\u9664\u8bb0\u5f55\u7acb\u5373\u63d0\u4ea4",level:2},{value:"9.9.5 \u6570\u636e\u5b58\u5728\u624d\u6839\u636e\u4e3b\u952e\u5220\u9664\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09",id:"995-\u6570\u636e\u5b58\u5728\u624d\u6839\u636e\u4e3b\u952e\u5220\u9664\u4e0d\u7acb\u5373\u63d0\u4ea4",level:2},{value:"9.9.6 \u6570\u636e\u5b58\u5728\u624d\u6839\u636e\u4e3b\u952e\u5220\u9664\uff08\u7acb\u5373\u63d0\u4ea4\uff09",id:"996-\u6570\u636e\u5b58\u5728\u624d\u6839\u636e\u4e3b\u952e\u5220\u9664\u7acb\u5373\u63d0\u4ea4",level:2},{value:"9.9.7 \u5047\u5220\u9664/\u8f6f\u5220\u9664",id:"997-\u5047\u5220\u9664\u8f6f\u5220\u9664",level:2},{value:"9.9.7.1 \u6dfb\u52a0 <code>[FakeDelete]</code> \u6807\u8bb0",id:"9971-\u6dfb\u52a0-fakedelete-\u6807\u8bb0",level:3},{value:"9.9.7.2 \u5047\u5220\u9664\u4f7f\u7528",id:"9972-\u5047\u5220\u9664\u4f7f\u7528",level:3},{value:"9.9.8 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"998-\u53cd\u9988\u4e0e\u5efa\u8bae",level:2}];function c(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,s.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.admonition,{title:"\u529f\u80fd\u79fb\u9664\u58f0\u660e",type:"warning",children:(0,t.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u5305\u542b ",(0,t.jsx)(n.code,{children:"Exists"})," \u5355\u8bcd\u7684\u5728 ",(0,t.jsx)(n.code,{children:"Furion 2.6.0 +"})," \u7248\u672c\u4e2d\u5df2\u79fb\u9664\u3002"]})}),"\n",(0,t.jsx)(n.h2,{id:"991-\u5220\u9664\u4e00\u4e2a\u5b9e\u4f53\u4e0d\u7acb\u5373\u63d0\u4ea4",children:"9.9.1 \u5220\u9664\u4e00\u4e2a\u5b9e\u4f53\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"// ==== \u540c\u6b65\u64cd\u4f5c ====\r\n\r\n// \u793a\u4f8b\u4e00\r\nrepository.Delete(user);\r\n\r\n// \u793a\u4f8b\u4e8c\r\nuser.Delete();\r\n\r\n// \u793a\u4f8b\u4e09\r\nrepository.ChangeEntityState(user, EntityState.Deleted);\r\n\r\n// \u793a\u4f8b\u56db\r\nrepository.Entities.Remove(user);\r\n\r\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\r\n\r\n// \u793a\u4f8b\u4e00\r\nawait repository.DeleteAsync(user);\r\n\r\