"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[8980],{4297:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>u,contentTitle:()=>a,default:()=>p,frontMatter:()=>c,metadata:()=>d,toc:()=>h});var t=r(5893),s=r(1151),o=r(510),i=(r(4996),r(4866)),l=r(5162);const c={id:"tran",title:"9.27 \u4e8b\u52a1\u548c\u5de5\u4f5c\u5355\u5143",sidebar_label:"9.27 \u4e8b\u52a1\u548c\u5de5\u4f5c\u5355\u5143 (UnitOfWork)"},a=void 0,d={id:"tran",title:"9.27 \u4e8b\u52a1\u548c\u5de5\u4f5c\u5355\u5143",description:"\ud83d\udcdd \u6a21\u5757\u66f4\u65b0\u65e5\u5fd7",source:"@site/docs/tran.mdx",sourceDirName:".",slug:"/tran",permalink:"/docs/tran",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/tran.mdx",tags:[],version:"current",lastUpdatedBy:"\u767e\u5c0f\u50e7",lastUpdatedAt:1698699579,formattedLastUpdatedAt:"Oct 30, 2023",frontMatter:{id:"tran",title:"9.27 \u4e8b\u52a1\u548c\u5de5\u4f5c\u5355\u5143",sidebar_label:"9.27 \u4e8b\u52a1\u548c\u5de5\u4f5c\u5355\u5143 (UnitOfWork)"},sidebar:"docs",previous:{title:"9.26 \u5b9e\u4f53\u6570\u636e\u76d1\u542c\u5668",permalink:"/docs/dbcontext-entitytrigger"},next:{title:"9.28 \u8bfb\u5199\u5206\u79bb/\u4e3b\u4ece\u590d\u5236",permalink:"/docs/dbcontext-read-write"}},u={},h=[{value:"9.27.1 \u4e8b\u52a1",id:"9271-\u4e8b\u52a1",level:2},{value:"9.27.2 \u5de5\u4f5c\u5355\u5143",id:"9272-\u5de5\u4f5c\u5355\u5143",level:2},{value:"9.27.3 \u5982\u4f55\u4f7f\u7528",id:"9273-\u5982\u4f55\u4f7f\u7528",level:2},{value:"9.27.3.1 [UnitOfWork]
\u81ea\u52a8\u7ba1\u7406",id:"92731-unitofwork-\u81ea\u52a8\u7ba1\u7406",level:3},{value:"9.27.3.2 EnsureTransaction()
\u65b9\u6cd5 \u2728",id:"92732-ensuretransaction-\u65b9\u6cd5-",level:3},{value:"9.27.3.2 \u624b\u52a8\u7ba1\u7406",id:"92732-\u624b\u52a8\u7ba1\u7406",level:3},{value:"9.27.3.3 EnableRetryOnFailure
\u9519\u8bef\u5904\u7406",id:"92733-enableretryonfailure-\u9519\u8bef\u5904\u7406",level:3},{value:"9.27.4 \u5de5\u4f5c\u5355\u5143\u7279\u6027\u8bf4\u660e",id:"9274-\u5de5\u4f5c\u5355\u5143\u7279\u6027\u8bf4\u660e",level:2},{value:"9.27.4.1 [UnitOfWork]
\u7279\u6027",id:"92741-unitofwork-\u7279\u6027",level:3},{value:"9.27.4.2 [ManualCommit]
\u7279\u6027",id:"92742-manualcommit-\u7279\u6027",level:3},{value:"9.27.5 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9275-\u53cd\u9988\u4e0e\u5efa\u8bae",level:2}];function x(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.a)(),...e.components},{Details:r}=n;return r||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Details",!0),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(r,{children:[(0,t.jsx)("summary",{children:"\ud83d\udcdd \u6a21\u5757\u66f4\u65b0\u65e5\u5fd7"}),(0,t.jsx)("div",{children:(0,t.jsx)("div",{children:(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.strong,{children:"\u95ee\u9898\u4fee\u590d"})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["\xa0",(0,t.jsx)(o.Z,{children:"\u4fee\u590d"})," ",(0,t.jsx)(n.code,{children:"Scoped.CreateUowAsync"})," \u4f5c\u7528\u57df\u5de5\u4f5c\u5355\u5143\u5f02\u5e38\u65e0\u6cd5\u56de\u6eda\u95ee\u9898 ",(0,t.jsx)("sup",{children:"4.8.8.44"})," ",(0,t.jsx)("sup",{children:"\u23f1\ufe0f2023.09.23"})," ",(0,t.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I833I9",children:"#I833I9"})]}),"\n"]}),"\n"]}),"\n"]})})})]}),"\n",(0,t.jsx)(n.h2,{id:"9271-\u4e8b\u52a1",children:"9.27.1 \u4e8b\u52a1"}),"\n",(0,t.jsxs)(n.p,{children:["\u4e8b\u52a1\u6307\u4f5c\u4e3a\u5355\u4e2a\u903b\u8f91\u5de5\u4f5c\u5355\u5143\u6267\u884c\u7684\u4e00\u7cfb\u5217\u64cd\u4f5c\uff0c\u8981\u4e48",(0,t.jsx)(n.strong,{children:"\u5b8c\u5168\u5730\u6267\u884c\uff0c\u8981\u4e48\u5b8c\u5168\u5730\u4e0d\u6267\u884c"}),"\u3002"]}),"\n",(0,t.jsxs)(n.p,{children:["\u7b80\u5355\u7684\u8bf4\uff0c\u4e8b\u52a1\u5c31\u662f\u5e76\u53d1\u63a7\u5236\u7684\u5355\u4f4d\uff0c\u662f\u7528\u6237\u5b9a\u4e49\u7684\u4e00\u4e2a\u64cd\u4f5c\u5e8f\u5217\u3002 \u800c\u4e00\u4e2a\u903b\u8f91\u5de5\u4f5c\u5355\u5143\u8981\u6210\u4e3a\u4e8b\u52a1\uff0c\u5c31\u5fc5\u987b\u6ee1\u8db3 ",(0,t.jsx)(n.code,{children:"ACID"})," \u5c5e\u6027\u3002"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"A"}),"\uff1a\u539f\u5b50\u6027\uff08Atomicity\uff09\uff1a\u4e8b\u52a1\u4e2d\u7684\u64cd\u4f5c\u8981\u4e48\u90fd\u4e0d\u505a\uff0c\u8981\u4e48\u5c31\u5168\u505a"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"C"}),"\uff1a\u4e00\u81f4\u6027\uff08Consistency\uff09\uff1a\u4e8b\u52a1\u6267\u884c\u7684\u7ed3\u679c\u5fc5\u987b\u662f\u4ece\u6570\u636e\u5e93\u4ece\u4e00\u4e2a\u4e00\u81f4\u6027\u72b6\u6001\u8f6c\u6362\u5230\u53e6\u4e00\u4e2a\u4e00\u81f4\u6027\u72b6\u6001"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"I"}),"\uff1a\u9694\u79bb\u6027\uff08Isolation\uff09\uff1a\u4e00\u4e2a\u4e8b\u52a1\u7684\u6267\u884c\u4e0d\u80fd\u88ab\u5176\u4ed6\u4e8b\u52a1\u5e72\u6270"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"D"}),"\uff1a\u6301\u4e45\u6027\uff08Durability\uff09\uff1a\u4e00\u4e2a\u4e8b\u52a1\u4e00\u65e6\u63d0\u4ea4\uff0c\u5b83\u5bf9\u6570\u636e\u5e93\u4e2d\u6570\u636e\u7684\u6539\u53d8\u5c31\u5e94\u8be5\u662f\u6c38\u4e45\u6027\u7684"]}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"9272-\u5de5\u4f5c\u5355\u5143",children:"9.27.2 \u5de5\u4f5c\u5355\u5143"}),"\n",(0,t.jsxs)(n.p,{children:["\u7b80\u5355\u6765\u8bf4\uff0c\u5c31\u662f\u4e3a\u4e86\u4fdd\u8bc1\u4e00\u6b21\u5b8c\u6574\u7684\u529f\u80fd\u64cd\u4f5c\u6240\u4ea7\u751f\u7684\u4e00\u7cfb\u5217\u63d0\u4ea4\u6570\u636e\u7684\u5b8c\u6574\u6027\uff0c\u8d77\u7740\u4e8b\u52a1\u7684\u4f5c\u7528\u3002\u5728\u8ba1\u7b97\u673a\u9886\u57df\u4e2d\uff0c\u5de5\u4f5c\u5355\u5143\u901a\u5e38\u7528 ",(0,t.jsx)(n.code,{children:"UnitOfWork"})," \u540d\u79f0\u8868\u793a\u3002"]}),"\n",(0,t.jsx)(n.p,{children:"\u901a\u5e38\u6211\u4eec\u4fdd\u8bc1\u7528\u6237\u7684\u6bcf\u4e00\u6b21\u8bf7\u6c42\u90fd\u662f\u5904\u4e8e\u5728\u4e00\u4e2a\u529f\u80fd\u5355\u5143\u4e2d\uff0c\u4e5f\u5c31\u662f\u5de5\u4f5c\u5355\u5143\u3002"}),"\n",(0,t.jsx)(n.h2,{id:"9273-\u5982\u4f55\u4f7f\u7528",children:"9.27.3 \u5982\u4f55\u4f7f\u7528"}),"\n",(0,t.jsxs)(n.h3,{id:"92731-unitofwork-\u81ea\u52a8\u7ba1\u7406",children:["9.27.3.1 ",(0,t.jsx)(n.code,{children:"[UnitOfWork]"})," \u81ea\u52a8\u7ba1\u7406"]}),"\n",(0,t.jsxs)(n.p,{children:["\u5728 ",(0,t.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u4e2d\uff0c\u6211\u4eec\u53ea\u9700\u8981\u5728\u63a7\u5236\u5668 Action \u4e2d\u8d34 ",(0,t.jsx)(n.code,{children:"[UnitOfWork]"})," \u7279\u6027\u5373\u53ef\u5f00\u542f\u5de5\u4f5c\u5355\u5143\u6a21\u5f0f\uff0c\u4fdd\u8bc1\u4e86\u6bcf\u4e00\u6b21\u8bf7\u6c42\u90fd\u662f\u4e00\u4e2a ",(0,t.jsx)(n.code,{children:"\u5de5\u4f5c\u5355\u5143"}),"\uff0c\u8981\u4e48\u540c\u65f6\u6210\u529f\uff0c\u8981\u4e48\u540c\u65f6\u5931\u8d25\u3002"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.strong,{children:"\u5355\u5e93\u64cd\u4f5c"})}),"\n"]}),"\n",(0,t.jsx)(n.p,{children:"\u4e0b\u9762\u65b9\u5f0f\u652f\u6301\u6240\u6709\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7c7b\u578b"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1}",children:'[UnitOfWork] // \u7531\u4e8e\u51fa\u73b0\u9519\u8bef\uff0c\u6240\u4ee5\u6240\u6709\u6570\u636e\u5e93\u53d8\u66f4\u90fd\u4f1a\u81ea\u52a8\u56de\u6eda\r\npublic async Task \u6d4b\u8bd5\u73af\u5883\u4e8b\u52a1(int id)\r\n{\r\n // \u5404\u79cd\u5947\u8469\u6570\u636e\u5e93\u64cd\u4f5c\r\n await _personRepository.DeleteNowAsync(id);\r\n\r\n // \u5176\u4ed6\u6570\u636e\u5e93\u64cd\u4f5c\u3002\u3002\r\n\r\n // \u6545\u610f\u51fa\u9519\r\n var d = await _personRepository.SqlQueriesAsync("select * from persion2 d");\r\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.strong,{children:"\u591a\u5e93\u64cd\u4f5c"})}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["\u652f\u6301\u5404\u79cd\u5947\u8469\u7684 ",(0,t.jsx)(n.code,{children:"ORM"}),"\uff0c\u5305\u62ec ",(0,t.jsx)(n.code,{children:"ADO.NET"}),"\uff0c",(0,t.jsx)(n.code,{children:"EFCore"})," \u7b49\u7b2c\u4e09\u65b9\uff0c",(0,t.jsxs)(n.strong,{children:["\u652f\u6301\u6240\u6709\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7c7b\u578b\u4f46\u4e0d\u652f\u6301 ",(0,t.jsx)(n.code,{children:"Sqlite"})]})]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'[UnitOfWork(UseAmbientTransaction = true)] // \u7531\u4e8e\u51fa\u73b0\u9519\u8bef\uff0c\u6240\u4ee5\u6240\u6709\u6570\u636e\u5e93\u53d8\u66f4\u90fd\u4f1a\u81ea\u52a8\u56de\u6eda\r\npublic async Task \u6d4b\u8bd5\u73af\u5883\u4e8b\u52a1(int id)\r\n{\r\n // \u5404\u79cd\u5947\u8469\u6570\u636e\u5e93\u64cd\u4f5c\r\n await _personRepository.DeleteNowAsync(id);\r\n\r\n // \u5176\u4ed6\u6570\u636e\u5e93\u64cd\u4f5c\u3002\u3002\r\n\r\n // \u6545\u610f\u51fa\u9519\r\n var d = await _personRepository.SqlQueriesAsync("select * from persion2 d");\r\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"UnitOfWork"})," \u5185\u7f6e\u914d\u7f6e\uff1a","\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"UseAmbientTransaction"}),"\uff1a\u662f\u5426\u5f00\u542f\u5206\u5e03\u5f0f\u73af\u5883\u4e8b\u52a1\uff0c",(0,t.jsx)(n.code,{children:"bool"})," \u7c7b\u578b\uff0c\u9ed8\u8ba4 ",(0,t.jsx)(n.code,{children:"false"}),"\uff0c",(0,t.jsxs)(n.strong,{children:["\u4e0d\u652f\u6301 ",(0,t.jsx)(n.code,{children:"Sqlite"})]})]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"TransactionScope"}),"\uff1a\u914d\u7f6e\u5206\u5e03\u5f0f\u73af\u5883\u4e8b\u52a1\u8303\u56f4\uff0c",(0,t.jsx)(n.code,{children:"TransactionScopeOption"})," \u7c7b\u578b\uff0c\u5f53 ",(0,t.jsx)(n.code,{children:"UseAmbientTransaction"})," \u4e3a ",(0,t.jsx)(n.code,{children:"true"})," \u6709\u6548"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"TransactionIsolationLevel"}),"\uff1a\u914d\u7f6e\u5206\u5e03\u5f0f\u73af\u5883\u4e8b\u52a1\u9694\u79bb\u7ea7\u522b\uff0c",(0,t.jsx)(n.code,{children:"IsolationLevel"})," \u7c7b\u578b\uff0c\u5f53 ",(0,t.jsx)(n.code,{children:"UseAmbientTransaction"})," \u4e3a ",(0,t.jsx)(n.code,{children:"true"})," \u6709\u6548"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"TransactionTimeout"}),"\uff1a\u914d\u7f6e\u5206\u5e03\u5f0f\u73af\u5883\u4e8b\u52a1\u6267\u884c\u8d85\u65f6\u65f6\u95f4\uff0c",(0,t.jsx)(n.code,{children:"int"})," \u7c7b\u578b\uff0c\u5f53 ",(0,t.jsx)(n.code,{children:"UseAmbientTransaction"})," \u4e3a ",(0,t.jsx)(n.code,{children:"true"})," \u6709\u6548"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"TransactionScopeAsyncFlow"}),"\uff1a\u914d\u7f6e\u5206\u5e03\u5f0f\u73af\u5883\u4e8b\u52a1\u5f02\u6b65\u6d41\u652f\u6301\uff0c",(0,t.jsx)(n.code,{children:"TransactionScopeAsyncFlowOption"})," \u7c7b\u578b\uff0c\u5f53 ",(0,t.jsx)(n.code,{children:"UseAmbientTransaction"})," \u4e3a ",(0,t.jsx)(n.code,{children:"true"})," \u6709\u6548"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"EnsureTransaction"}),"\uff1a\u5f3a\u5236\u4f7f\u5b57\u7b26\u4e32 ",(0,t.jsx)(n.code,{children:"sql"})," \u62d3\u5c55\u4e8b\u52a1\u6709\u6548\uff0c",(0,t.jsx)(n.code,{children:"bool"})," \u7c7b\u578b\uff0c\u9ed8\u8ba4 ",(0,t.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,t.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,t.jsx)(n.code,{children:"Furion 3.7.3 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,t.jsxs)(n.p,{children:["\u5982\u4f7f\u7528\u975e ",(0,t.jsx)(n.code,{children:"EFCore"})," ORM \u6846\u67b6\uff0c\u53ef\u5b9e\u73b0 ",(0,t.jsx)(n.code,{children:"IUnitOfWork"})," \u63a5\u53e3\u4e4b\u540e\u8c03\u7528 ",(0,t.jsx)(n.code,{children:"services.AddUnitOfWork()"})," \u6ce8\u518c\u5373\u53ef\uff0c\u5982\u793a\u4f8b\u4ee3\u7801\uff1a"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {8,30,41,52,63}",children:'using Microsoft.AspNetCore.Mvc.Filters;\r\n\r\nnamespace Furion.DatabaseAccessor;\r\n\r\n/// \r\n/// SqlSugar \u5de5\u4f5c\u5355\u5143\u5b9e\u73b0\r\n/// \r\npublic sealed class SqlSugarUnitOfWork : IUnitOfWork\r\n{\r\n /// \r\n /// SqlSugar \u5bf9\u8c61\r\n /// \r\n private readonly ISqlSugarClient _sqlSugarClient;\r\n\r\n /// \r\n /// \u6784\u9020\u51fd\u6570\r\n /// \r\n /// \r\n public SqlSugarUnitOfWork(ISqlSugarClient sqlSugarClient)\r\n {\r\n _sqlSugarClient = sqlSugarClient;\r\n }\r\n\r\n /// \r\n /// \u5f00\u542f\u5de5\u4f5c\u5355\u5143\u5904\u7406\r\n /// \r\n /// \r\n /// \r\n /// \r\n public void BeginTransaction(FilterContext context, UnitOfWorkAttribute unitOfWork)\r\n {\r\n _sqlSugarClient.AsTenant().BeginTran();\r\n }\r\n\r\n /// \r\n /// \u63d0\u4ea4\u5de5\u4f5c\u5355\u5143\u5904\u7406\r\n /// \r\n /// \r\n /// \r\n /// \r\n public void CommitTransaction(FilterContext resultContext, UnitOfWorkAttribute unitOfWork)\r\n {\r\n _sqlSugarClient.AsTenant().CommitTran();\r\n }\r\n\r\n /// \r\n /// \u56de\u6eda\u5de5\u4f5c\u5355\u5143\u5904\u7406\r\n /// \r\n /// \r\n /// \r\n /// \r\n public void RollbackTransaction(FilterContext resultContext, UnitOfWorkAttribute unitOfWork)\r\n {\r\n _sqlSugarClient.AsTenant().RollbackTran();\r\n }\r\n\r\n /// \r\n /// \u6267\u884c\u5b8c\u6bd5\uff08\u65e0\u8bba\u6210\u529f\u5931\u8d25\uff09\r\n /// \r\n /// \r\n /// \r\n /// \r\n public void OnCompleted(FilterContext context, FilterContext resultContext)\r\n {\r\n _sqlSugarClient.Dispose();\r\n }\r\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"\u4e4b\u540e\u6ce8\u518c\u5373\u53ef\uff1a"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddUnitOfWork();\n"})}),"\n",(0,t.jsx)(n.admonition,{title:"\u5c0f\u77e5\u8bc6-\u5982\u4f55\u5224\u65ad\u662f\u5426\u5f00\u542f\u4e86\u5206\u5e03\u5f0f\u73af\u5883\u4e8b\u52a1",type:"tip",children:(0,t.jsxs)(n.p,{children:["\u6709\u65f6\u5019\u6211\u4eec\u81ea\u5b9a\u4e49\u4e86\u5de5\u4f5c\u5355\u5143\u4e4b\u540e\uff0c\u4e2a\u522b ",(0,t.jsx)(n.code,{children:"ORM"})," \u4e0d\u652f\u6301\u5206\u5e03\u5f0f\u73af\u5883\u4e8b\u52a1\uff0c\u90a3\u4e48\u5c31\u4f1a\u51fa\u73b0\u6267\u884c\u9519\u8bef\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7 ",(0,t.jsx)(n.code,{children:"System.Transactions.Transaction.Current != null"})," \u6765\u5224\u65ad\u662f\u5426\u542f\u7528\u4e86\u5206\u5e03\u5f0f\u73af\u5883\u4e8b\u52a1\uff0c\u4e0d\u7b49\u4e8e ",(0,t.jsx)(n.code,{children:"null"})," \u5219\u4e3a\u542f\u7528\uff0c\u5426\u5219\u672a\u542f\u7528\u3002"]})}),"\n",(0,t.jsxs)(n.h3,{id:"92732-ensuretransaction-\u65b9\u6cd5-",children:["9.27.3.2 ",(0,t.jsx)(n.code,{children:"EnsureTransaction()"})," \u65b9\u6cd5 \u2728"]}),"\n",(0,t.jsxs)(n.p,{children:["\u6709\u4e9b\u65f6\u5019\u6211\u4eec\u901a\u8fc7\u9759\u6001\u7c7b\u6216\u8005\u5176\u4ed6\u65b9\u5f0f\u4e0d\u5c0f\u5fc3\u521b\u5efa\u4e86\u65b0\u7684 ",(0,t.jsx)(n.code,{children:"DbContext"})," \u5b9e\u4f8b\uff0c\u8fd9\u65f6\u5019\u8d34\u4e86 ",(0,t.jsx)(n.code,{children:"[UnitOfWork]"})," \u4e5f\u4e0d\u89c1\u8d77\u6548\uff0c\u8fd9\u65f6\u5019\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u6765\u786e\u8ba4\u4e8b\u52a1\u662f\u5426\u6709\u6548\uff1a"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"repository.EnsureTransaction();\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsxs)(n.strong,{children:["\u5982\u679c\u4e0d\u559c\u6b22\u624b\u52a8\u65b9\u5f0f\u4e5f\u53ef\u4ee5\u901a\u8fc7 ",(0,t.jsx)(n.code,{children:"[UnitOfWork(true)]"})," \u5f00\u542f\u6b64\u529f\u80fd\u3002"]})}),"\n",(0,t.jsx)(n.p,{children:"\u8be5\u65b9\u6cd5\u4f1a\u5c06\u5f53\u524d\u4ed3\u50a8\u6dfb\u52a0\u5230\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6c60\u4e2d\uff0c\u5e76\u786e\u4fdd\u4e8b\u52a1\u53ef\u7528\u3002"}),"\n",(0,t.jsx)(n.h3,{id:"92732-\u624b\u52a8\u7ba1\u7406",children:"9.27.3.2 \u624b\u52a8\u7ba1\u7406"}),"\n",(0,t.jsxs)(i.Z,{defaultValue:"one",values:[{label:"\u793a\u4f8b\u4e00",value:"one"},{label:"\u793a\u4f8b\u4e8c",value:"two"},{label:"\u793a\u4f8b\u4e09\uff08\u5206\u5e03\u5f0f\uff09",value:"three"}],children:[(0,t.jsx)(l.Z,{value:"one",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'// \u5f00\u542f\u4e8b\u52a1\r\nusing (var transaction = _testRepository.Database.BeginTransaction())\r\n{\r\n try\r\n {\r\n _testRepository.Insert(new Blog { Url = "http://blogs.msdn.com/dotnet" });\r\n _testRepository.SaveNow();\r\n\r\n _testRepository.Insert(new Blog { Url = "http://blogs.msdn.com/visualstudio" });\r\n _testRepository.SaveNow();\r\n\r\n var blogs = _testRepository.Entity\r\n .OrderBy(b => b.Url)\r\n .ToList();\r\n\r\n // \u63d0\u4ea4\u4e8b\u52a1\r\n transaction.Commit();\r\n }\r\n catch (Exception)\r\n {\r\n // \u56de\u6eda\u4e8b\u52a1\r\n // transaction.RollBack(); // \u65b0\u7248\u672c\u81ea\u52a8\u56de\u6eda\u4e86\r\n }\r\n}\n'})})}),(0,t.jsx)(l.Z,{value:"two",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'var options = new DbContextOptionsBuilder()\r\n .UseSqlServer(new SqlConnection(connectionString))\r\n .Options;\r\n\r\n// \u521b\u5efa\u8fde\u63a5\u5b57\u7b26\u4e32\r\nusing (var context1 = new DefaultDbContext(options))\r\n{\r\n // \u5f00\u542f\u4e8b\u52a1\r\n using (var transaction = context1.Database.BeginTransaction())\r\n {\r\n try\r\n {\r\n _testRepository.Insert(new Blog { Url = "http://blogs.msdn.com/dotnet" });\r\n _testRepository.SaveNow();\r\n\r\n context1.Blogs.Add(new Blog { Url = "http://blogs.msdn.com/dotnet" });\r\n context1.SaveChanges();\r\n\r\n // \u521b\u5efa\u65b0\u7684\u8fde\u63a5\u5bf9\u8c61\r\n using (var context2 = new DefaultDbContext(options))\r\n {\r\n // \u5171\u4eab\u8fde\u63a5\u4e8b\u52a1\r\n context2.Database.UseTransaction(transaction.GetDbTransaction());\r\n\r\n var blogs = context2.Blogs\r\n .OrderBy(b => b.Url)\r\n .ToList();\r\n }\r\n\r\n // \u63d0\u4ea4\u4e8b\u52a1\r\n transaction.Commit();\r\n }\r\n catch (Exception)\r\n {\r\n // \u56de\u6eda\u4e8b\u52a1\r\n // transaction.RollBack(); // \u65b0\u7248\u672c\u81ea\u52a8\u56de\u6eda\u4e86\r\n }\r\n }\r\n}\n'})})}),(0,t.jsx)(l.Z,{value:"three",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1-3}",children:'// \u5f00\u542f\u5206\u5e03\u5f0f\u4e8b\u52a1\r\n// \u5982\u679c\u4e8b\u52a1\u5305\u88f9\u7684\u4ee3\u7801\u4e2d\u5305\u542b\u5f02\u6b65 async/await\uff0c\u90a3\u4e48\u9700\u8981\u8bbe\u7f6e TransactionScopeAsyncFlowOption.Enabled = true\r\nusing (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted }))\r\n{\r\n using (var connection = new SqlConnection(connectionString))\r\n {\r\n connection.Open();\r\n\r\n try\r\n {\r\n // \u8fd9\u91cc\u662f Ado.NET \u64cd\u4f5c\r\n var command = connection.CreateCommand();\r\n command.CommandText = "DELETE FROM dbo.Blogs";\r\n command.ExecuteNonQuery();\r\n\r\n // \u521b\u5efaEF Core \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\r\n var options = new DbContextOptionsBuilder()\r\n .UseSqlServer(connection)\r\n .Options;\r\n using (var context = new BloggingContext(options))\r\n {\r\n context.Blogs.Add(new Blog { Url = "http://blogs.msdn.com/dotnet" });\r\n context.SaveChanges();\r\n }\r\n\r\n // \u6846\u67b6\u5c01\u88c5\u7684\u4ed3\u50a8\r\n _testRepository.Insert(new Blog { Url = "http://blogs.msdn.com/dotnet" });\r\n _testRepository.SaveChanges();\r\n\r\n // \u63d0\u4ea4\u4e8b\u52a1\r\n scope.Complete();\r\n }\r\n catch (System.Exception)\r\n {\r\n // \u81ea\u52a8\u56de\u6eda\r\n }\r\n }\r\n}\n'})})})]}),"\n",(0,t.jsxs)(n.h3,{id:"92733-enableretryonfailure-\u9519\u8bef\u5904\u7406",children:["9.27.3.3 ",(0,t.jsx)(n.code,{children:"EnableRetryOnFailure"})," \u9519\u8bef\u5904\u7406"]}),"\n",(0,t.jsxs)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"caution",children:[(0,t.jsxs)(n.p,{children:["\u5982\u679c\u4f7f\u7528\u7684\u662f ",(0,t.jsx)(n.code,{children:"EFCore"})," \u6570\u636e\u5e93\u4e14\u542f\u7528\u4e86 ",(0,t.jsx)(n.code,{children:"EnableRetryOnFailure()"})," \u529f\u80fd\uff0c\u90a3\u4e48 ",(0,t.jsx)(n.code,{children:"[UnitOfWork]"})," \u5c06\u629b\u51fa\u4ee5\u4e0b\u9519\u8bef\uff1a"]}),(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"InvalidOperationException: The configured execution strategy 'SqlServerRetryingExecutionStrategy' does not support user-initiated transactions.\r\nUse the execution strategy returned by 'DbContext.Database.CreateExecutionStrategy()' to execute all the operations in the transaction as a retriable unit.\n"})}),(0,t.jsxs)(n.p,{children:["\u8fd9\u65f6\u5019\u9700\u624b\u52a8\u4e8b\u52a1\uff0c\u5e76\u521b\u5efa\u6267\u884c\u7b56\u7565\uff1a",(0,t.jsx)(n.code,{children:"CreateExecutionStrategy"}),"\uff0c\u8be6\u60c5\u8bf7\u53c2\u8003\u5b98\u65b9\u8bf4\u660e\uff1a",(0,t.jsx)(n.a,{href:"https://learn.microsoft.com/zh-cn/ef/core/miscellaneous/connection-resiliency",children:"https://learn.microsoft.com/zh-cn/ef/core/miscellaneous/connection-resiliency"})]}),(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,4,8,16}",children:'using var db = new BloggingContext();\r\nvar strategy = db.Database.CreateExecutionStrategy();\r\n\r\nstrategy.Execute(\r\n () =>\r\n {\r\n using var context = new BloggingContext();\r\n using var transaction = context.Database.BeginTransaction();\r\n\r\n context.Blogs.Add(new Blog { Url = "http://blogs.msdn.com/dotnet" });\r\n context.SaveChanges();\r\n\r\n context.Blogs.Add(new Blog { Url = "http://blogs.msdn.com/visualstudio" });\r\n context.SaveChanges();\r\n\r\n transaction.Commit();\r\n });\n'})})]}),"\n",(0,t.jsx)(n.h2,{id:"9274-\u5de5\u4f5c\u5355\u5143\u7279\u6027\u8bf4\u660e",children:"9.27.4 \u5de5\u4f5c\u5355\u5143\u7279\u6027\u8bf4\u660e"}),"\n",(0,t.jsxs)(n.h3,{id:"92741-unitofwork-\u7279\u6027",children:["9.27.4.1 ",(0,t.jsx)(n.code,{children:"[UnitOfWork]"})," \u7279\u6027"]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"[UnitOfWork]"})," \u7279\u6027\u53ea\u80fd\u7528\u4e8e\u63a7\u5236\u5668\u7684 ",(0,t.jsx)(n.code,{children:"Action"})," \u4e2d\uff0c\u4e00\u65e6\u8d34\u4e86 ",(0,t.jsx)(n.code,{children:"[UnitOfWork]"})," \u7279\u6027\u540e\uff0c\u90a3\u4e48\u8be5\u8bf7\u6c42\u81ea\u52a8\u542f\u7528\u5de5\u4f5c\u5355\u5143\u6a21\u5f0f\uff0c\u8981\u4e48\u6210\u529f\uff0c\u8981\u4e48\u5931\u8d25\u3002"]}),"\n",(0,t.jsxs)(n.h3,{id:"92742-manualcommit-\u7279\u6027",children:["9.27.4.2 ",(0,t.jsx)(n.code,{children:"[ManualCommit]"})," \u7279\u6027"]}),"\n",(0,t.jsxs)(n.p,{children:["\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",(0,t.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u4f1a\u5728\u4e00\u6b21\u6210\u529f\u8bf7\u6c42\u4e4b\u540e\u81ea\u52a8\u8c03\u7528 ",(0,t.jsx)(n.code,{children:"SaveChanges()"})," \u65b9\u6cd5\uff0c\u5982\u679c\u9009\u62e9\u624b\u52a8\u8c03\u7528 ",(0,t.jsx)(n.code,{children:"SaveChanges()"})," \u65b9\u6cd5\uff0c\u53ef\u4ee5\u5728\u63a7\u5236\u5668 ",(0,t.jsx)(n.code,{children:"Action"})," \u4e2d\u8d34 ",(0,t.jsx)(n.code,{children:"[ManualCommit]"})," \u7279\u6027\u5373\u53ef\u3002"]}),"\n",(0,t.jsx)(n.h2,{id:"9275-\u53cd\u9988\u4e0e\u5efa\u8bae",children:"9.27.5 \u53cd\u9988\u4e0e\u5efa\u8bae"}),"\n",(0,t.jsx)(n.admonition,{title:"\u4e0e\u6211\u4eec\u4ea4\u6d41",type:"note",children:(0,t.jsxs)(n.p,{children:["\u7ed9 Furion \u63d0 ",(0,t.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/new?issue",children:"Issue"}),"\u3002"]})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.admonition,{title:"\u4e86\u89e3\u66f4\u591a",type:"note",children:(0,t.jsxs)(n.p,{children:["\u60f3\u4e86\u89e3\u66f4\u591a ",(0,t.jsx)(n.code,{children:"\u4e8b\u52a1"})," \u77e5\u8bc6\u53ef\u67e5\u9605 ",(0,t.jsx)(n.a,{href:"https://docs.microsoft.com/zh-cn/ef/core/saving/transactions",children:"EF Core - \u4f7f\u7528\u4e8b\u52a1"})," \u7ae0\u8282\u3002"]})})]})}function p(e={}){const{wrapper:n}={...(0,s.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(x,{...e})}):x(e)}},5162:(e,n,r)=>{r.d(n,{Z:()=>i});r(7294);var t=r(4334);const s={tabItem:"tabItem_Ymn6"};var o=r(5893);function i(e){let{children:n,hidden:r,className:i}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,t.Z)(s.tabItem,i),hidden:r,children:n})}},4866:(e,n,r)=>{r.d(n,{Z:()=>C});var t=r(7294),s=r(4334),o=r(2466),i=r(6550),l=r(469),c=r(1980),a=r(7392),d=r(12);function u(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:r}=e;return(0,t.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:r,attributes:t,default:s}}=e;return{value:n,label:r,attributes:t,default:s}}))}(r);return function(e){const n=(0,a.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,r])}function x(e){let{value:n,tabValues:r}=e;return r.some((e=>e.value===n))}function p(e){let{queryString:n=!1,groupId:r}=e;const s=(0,i.k6)(),o=function(e){let{queryString:n=!1,groupId:r}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return r??null}({queryString:n,groupId:r});return[(0,c._X)(o),(0,t.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(s.location.search);n.set(o,e),s.replace({...s.location,search:n.toString()})}),[o,s])]}function m(e){const{defaultValue:n,queryString:r=!1,groupId:s}=e,o=h(e),[i,c]=(0,t.useState)((()=>function(e){let{defaultValue:n,tabValues:r}=e;if(0===r.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!x({value:n,tabValues:r}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${r.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const t=r.find((e=>e.default))??r[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:o}))),[a,u]=p({queryString:r,groupId:s}),[m,j]=function(e){let{groupId:n}=e;const r=function(e){return e?`docusaurus.tab.${e}`:null}(n),[s,o]=(0,d.Nk)(r);return[s,(0,t.useCallback)((e=>{r&&o.set(e)}),[r,o])]}({groupId:s}),g=(()=>{const e=a??m;return x({value:e,tabValues:o})?e:null})();(0,l.Z)((()=>{g&&c(g)}),[g]);return{selectedValue:i,selectValue:(0,t.useCallback)((e=>{if(!x({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);c(e),u(e),j(e)}),[u,j,o]),tabValues:o}}var j=r(2389);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=r(5893);function v(e){let{className:n,block:r,selectedValue:t,selectValue:i,tabValues:l}=e;const c=[],{blockElementScrollPositionUntilNextRender:a}=(0,o.o5)(),d=e=>{const n=e.currentTarget,r=c.indexOf(n),s=l[r].value;s!==t&&(a(n),i(s))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const r=c.indexOf(e.currentTarget)+1;n=c[r]??c[0];break}case"ArrowLeft":{const r=c.indexOf(e.currentTarget)-1;n=c[r]??c[c.length-1];break}}n?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":r},n),children:l.map((e=>{let{value:n,label:r,attributes:o}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:t===n?0:-1,"aria-selected":t===n,ref:e=>c.push(e),onKeyDown:u,onClick:d,...o,className:(0,s.Z)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":t===n}),children:r??n},n)}))})}function f(e){let{lazy:n,children:r,selectedValue:s}=e;const o=(Array.isArray(r)?r:[r]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===s));return e?(0,t.cloneElement)(e,{className:"margin-top--md"}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,t.cloneElement)(e,{key:n,hidden:e.props.value!==s})))})}function y(e){const n=m(e);return(0,b.jsxs)("div",{className:(0,s.Z)("tabs-container",g.tabList),children:[(0,b.jsx)(v,{...e,...n}),(0,b.jsx)(f,{...e,...n})]})}function C(e){const n=(0,j.Z)();return(0,b.jsx)(y,{...e,children:u(e.children)},String(n))}},510:(e,n,r)=>{r.d(n,{Z:()=>F});r(7294);const t=(e,n,r)=>e?"string"==typeof e?e:e[n]||r:r;var s=r(5893);const o={display:"block"},i=e=>{let{size:n,color:r,style:i,...l}=e;const c=i?{...o,...i}:o;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:c,...l,children:(0,s.jsx)("path",{d:"M856.4 292.8c-63.3-63.6-126.6-127.1-190.2-190.3-15.3-15.2-32.7-16.1-48.1-0.8-64.3 63.6-128.1 127.6-191.8 191.9-14 14.2-16.3 31.6-1.7 46 14.8 14.7 31.5 10.6 46.1-2.7 5.1-4.6 9.8-9.7 14.7-14.7 39.2-39.7 78.5-79.5 122.8-124.4 0 170 3 332.2-1.1 494-2.4 96.4-91.2 174.6-187.4 176.6-110.6 2.3-198.6-84.4-199-197.4-0.6-136.3-0.2-272.6-0.1-408.9 0-21.8-7.9-37.4-31.2-39.9-18.9-2-33.2 13.2-33.1 37.5 0 145.8-3.4 291.7 2.4 437.2 6 152.1 160.4 263.5 309.5 230.5C591.8 900 672.8 797.2 673.6 664.6c0.8-144 0.2-288.1 0.2-432.1v-33.3c11.2 10.2 17.6 15.4 23.3 21.3 38.5 38.4 76.7 77 115.3 115.2 14.8 14.6 32.2 19.2 47.8 2.9 13.8-14.8 10.3-31.7-3.8-45.8z",fill:t(r,0,"#333333")})})};i.defaultProps={size:18};const l=i,c={display:"block"},a=e=>{let{size:n,color:r,style:o,...i}=e;const l=o?{...c,...o}:c;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...i,children:[(0,s.jsx)("path",{d:"M143.872 768a51.2 51.2 0 0 1-15.36-2.56 51.2 51.2 0 0 1-35.328-51.2V283.136a148.992 148.992 0 0 1 141.824-153.6h450.56a148.992 148.992 0 0 1 141.824 153.6V512a148.992 148.992 0 0 1-141.824 153.6H244.224l-60.928 80.896a51.2 51.2 0 0 1-39.424 21.504zM235.008 180.224a97.792 97.792 0 0 0-90.624 102.4v430.592L218.624 614.4h466.944a97.792 97.792 0 0 0 90.624-102.4V283.136a97.792 97.792 0 0 0-90.624-102.4z",fill:t(r,0,"#333333")}),(0,s.jsx)("path",{d:"M880.128 875.52a51.2 51.2 0 0 1-39.424-20.48l-60.928-80.896h-243.2a25.6 25.6 0 0 1 0-51.2h268.8l76.288 102.4v-295.936a25.6 25.6 0 0 1 25.6-25.6 25.6 25.6 0 0 1 25.6 25.6v293.888a51.2 51.2 0 0 1-51.2 51.2z",fill:t(r,1,"#333333")})]})};a.defaultProps={size:18};const d=a,u={display:"block"},h=e=>{let{size:n,color:r,style:o,...i}=e;const l=o?{...u,...o}:u;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...i,children:[(0,s.jsx)("path",{d:"M223.425605 449.2744l161.632237 0 0 253.65714c0 16.954137 13.745049 30.699186 30.699186 30.699186 16.95516 0 30.699186-13.745049 30.699186-30.699186l0-284.356326c0-16.95516-13.744026-30.699186-30.699186-30.699186L291.035446 387.876028l217.23665-248.51605L733.039255 387.580293 607.104031 387.580293c-16.954137 0-30.699186 13.745049-30.699186 30.699186l0 284.652062c0 16.954137 13.745049 30.699186 30.699186 30.699186s30.699186-13.745049 30.699186-30.699186L637.803217 448.978664l164.448376 0c12.140505 0 23.140023-7.154957 28.063149-18.251689 4.922103-11.097756 2.841721-24.053835-5.307889-33.05279L530.62315 72.570829c-5.881964-6.495948-14.273075-10.134825-23.024389-10.091846-8.763594 0.076748-17.076934 3.895727-22.844288 10.494005L200.312188 398.371056c-7.92653 9.067516-9.818623 21.931498-4.839215 32.896224S211.383338 449.2744 223.425605 449.2744z",fill:t(r,0,"#333333")}),(0,s.jsx)("path",{d:"M222.354204 829.113381l581.732178 0c16.954137 0 30.699186-13.745049 30.699186-30.699186s-13.745049-30.699186-30.699186-30.699186L222.354204 767.715009c-16.954137 0-30.699186 13.745049-30.699186 30.699186S205.400067 829.113381 222.354204 829.113381z",fill:t(r,1,"#333333")}),(0,s.jsx)("path",{d:"M804.086381 896.729361 222.354204 896.729361c-16.954137 0-30.699186 13.745049-30.699186 30.699186s13.745049 30.699186 30.699186 30.699186l581.732178 0c16.954137 0 30.699186-13.745049 30.699186-30.699186S821.041542 896.729361 804.086381 896.729361z",fill:t(r,2,"#333333")})]})};h.defaultProps={size:18};const x=h,p={display:"block"},m=e=>{let{size:n,color:r,style:o,...i}=e;const l=o?{...p,...o}:p;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...i,children:(0,s.jsx)("path",{d:"M380.15463648 874.54223633c0 18.12744166-14.83154297 32.95898463-32.95898463 32.95898463s-32.95898463-14.83154297-32.95898462-32.95898463V228.9152832L172.71078883 370.86962865a33.04467773 33.04467773 0 0 1-46.60400416 0 33.04467773 33.04467773 0 0 1 0-46.6040034l197.55615234-198.14941406A32.76782227 32.76782227 0 0 1 347.0967749 116.52514674c0.03295924 0 0.06591772-0.03295924 0.09887695-0.03295924 1.54907201 0 2.90039088 0.69213867 4.41650366 0.88989258 2.66967773 0.39550781 5.40527318 0.59326172 7.94311548 1.61499049 12.03002904 4.94384766 20.59936549 16.71020508 20.59936549 30.45410156v725.0910642z m320.15698192 23.34155248a32.85351537 32.85351537 0 0 1-23.43383789 9.59106445c-0.03295924 0-0.06591772 0.03295924-0.09887696 0.03295924-1.54907201 0-2.90039088-0.69213867-4.41650365-0.92285182-2.70263697-0.36254857-5.40527318-0.56030248-7.94311549-1.61498972-12.03002904-4.91088842-20.59936549-16.67724584-20.59936473-30.42114309V149.45776367c0-18.12744166 14.83154297-32.95898463 32.95898387-32.95898463s32.95898463 14.83154297 32.95898463 32.95898463v645.60058619l141.52587916-141.92138697c12.81445313-12.82104467 33.81591797-12.82104467 46.63037109 0 12.78808619 12.81445313 12.78808619 33.77636719 0 46.60400416L700.3116184 897.88378881z",fill:t(r,0,"#333333")})})};m.defaultProps={size:18};const j=m,g={display:"block"},b=e=>{let{size:n,color:r,style:o,...i}=e;const l=o?{...g,...o}:g;return(0,s.jsx)("svg",{viewBox:"0 0 1172 1024",width:n+"px",height:n+"px",style:l,...i,children:(0,s.jsx)("path",{d:"M870.0416 250.4704a38.4 38.4 0 0 0-8.96 53.5552c13.056 18.2784 24.4224 37.8368 33.7408 58.112a38.4512 38.4512 0 0 0 50.944 18.8928 38.4512 38.4512 0 0 0 18.8416-50.944 436.0192 436.0192 0 0 0-40.96-70.6048 38.3488 38.3488 0 0 0-53.6064-9.0112zM181.4528 566.016a35.9936 35.9936 0 0 0 25.5488-10.5984L351.7952 410.624a36.096 36.096 0 1 0-51.0976-51.0976L217.6 442.5728C250.0096 278.1184 395.264 153.6 569.1392 153.6c50.7904 0 99.8912 10.3936 145.92 30.9248a38.4 38.4 0 1 0 31.232-70.0928 431.36 431.36 0 0 0-177.152-37.632c-214.6816 0-393.1136 156.416-428.4416 361.216L62.1568 359.4752a36.1984 36.1984 0 0 0-51.0976 51.0976l144.8448 144.7936a36.0448 36.0448 0 0 0 25.5488 10.6496zM978.5344 463.104a36.1984 36.1984 0 0 0-51.0976 0l-144.8448 144.7936a36.096 36.096 0 1 0 51.0976 51.0976l88.6272-88.576C894.3104 740.2496 746.8032 870.4 569.1392 870.4a357.7856 357.7856 0 0 1-325.2736-207.7184 38.4 38.4 0 1 0-69.7344 32.3072 434.3808 434.3808 0 0 0 394.9568 252.2112c215.1936 0 393.984-157.184 428.6464-362.7008l74.496 74.496a35.9936 35.9936 0 0 0 51.0976 0 36.096 36.096 0 0 0 0-51.0976l-144.7936-144.7936z",fill:t(r,0,"#333333")})})};b.defaultProps={size:18};const v=b,f={display:"block"},y=e=>{let{size:n,color:r,style:o,...i}=e;const l=o?{...f,...o}:f;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...i,children:[(0,s.jsx)("path",{d:"M302 332a30 30 0 1 1 0-60h420a30 30 0 0 1 0 60H302zM302 542a30 30 0 0 1 0-60h420a30 30 0 0 1 0 60H302zM302 752a30 30 0 0 1 0-60h120a30 30 0 0 1 0 60H302z",fill:t(r,0,"#333333")}),(0,s.jsx)("path",{d:"M789.47 784.1a30 30 0 0 1 39.36 45.3l-144.24 125.25a30 30 0 0 1-19.68 7.35H214.85C163.4 962 122 919.46 122 867.38V156.62C122 104.54 163.4 62 214.85 62h594.3C860.6 62 902 104.54 902 156.62v529.05a30 30 0 1 1-60 0V156.62C842 137.3 827.09 122 809.15 122H214.85C196.91 122 182 137.3 182 156.62v710.76C182 886.7 196.91 902 214.85 902h438.84l135.78-117.9z",fill:t(r,1,"#333333")}),(0,s.jsx)("path",{d:"M692 931.19a30 30 0 1 1-60 0v-174.6C632 704.57 673.4 662 724.85 662h147.78a30 30 0 0 1 0 60h-147.78c-17.94 0-32.85 15.3-32.85 34.62v174.6z",fill:t(r,2,"#333333")})]})};y.defaultProps={size:18};const C=y,w={display:"block"},k=e=>{let{size:n,color:r,style:o,...i}=e;const l=o?{...w,...o}:w;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...i,children:[(0,s.jsx)("path",{d:"M512 883.2A371.2 371.2 0 1 0 140.8 512 371.2 371.2 0 0 0 512 883.2z m0 64a435.2 435.2 0 1 1 435.2-435.2 435.2 435.2 0 0 1-435.2 435.2z",fill:t(r,0,"#333333")}),(0,s.jsx)("path",{d:"M557.056 512l122.368 122.368a31.744 31.744 0 1 1-45.056 45.056L512 557.056l-122.368 122.368a31.744 31.744 0 1 1-45.056-45.056L466.944 512 344.576 389.632a31.744 31.744 0 1 1 45.056-45.056L512 466.944l122.368-122.368a31.744 31.744 0 1 1 45.056 45.056z",fill:t(r,1,"#333333")})]})};k.defaultProps={size:18};const S=k,z={display:"block"},T=e=>{let{size:n,color:r,style:o,...i}=e;const l=o?{...z,...o}:z;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...i,children:[(0,s.jsx)("path",{d:"M940 512H792V412c76.8 0 139-62.2 139-139 0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 34.8-28.2 63-63 63H232c-34.8 0-63-28.2-63-63 0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 76.8 62.2 139 139 139v100H84c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h148v96c0 6.5 0.2 13 0.7 19.3C164.1 728.6 116 796.7 116 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-44.2 23.9-82.9 59.6-103.7 6 17.2 13.6 33.6 22.7 49 24.3 41.5 59 76.2 100.5 100.5S460.5 960 512 960s99.8-13.9 141.3-38.2c41.5-24.3 76.2-59 100.5-100.5 9.1-15.5 16.7-31.9 22.7-49C812.1 793.1 836 831.8 836 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-79.3-48.1-147.4-116.7-176.7 0.4-6.4 0.7-12.8 0.7-19.3v-96h148c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM716 680c0 36.8-9.7 72-27.8 102.9-17.7 30.3-43 55.6-73.3 73.3-20.1 11.8-42 20-64.9 24.3V484c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v396.5c-22.9-4.3-44.8-12.5-64.9-24.3-30.3-17.7-55.6-43-73.3-73.3C317.7 752 308 716.8 308 680V412h408v268z",fill:t(r,0,"#333333")}),(0,s.jsx)("path",{d:"M304 280h56c4.4 0 8-3.6 8-8 0-28.3 5.9-53.2 17.1-73.5 10.6-19.4 26-34.8 45.4-45.4C450.9 142 475.7 136 504 136h16c28.3 0 53.2 5.9 73.5 17.1 19.4 10.6 34.8 26 45.4 45.4C650 218.9 656 243.7 656 272c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-40-8.8-76.7-25.9-108.1-17.2-31.5-42.5-56.8-74-74C596.7 72.8 560 64 520 64h-16c-40 0-76.7 8.8-108.1 25.9-31.5 17.2-56.8 42.5-74 74C304.8 195.3 296 232 296 272c0 4.4 3.6 8 8 8z",fill:t(r,1,"#333333")})]})};T.defaultProps={size:18};const O=T,U={display:"block"},E=e=>{let{size:n,color:r,style:o,...i}=e;const l=o?{...U,...o}:U;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...i,children:[(0,s.jsx)("path",{d:"M512 71.68c-242.688 0-440.32 197.632-440.32 440.32s197.632 440.32 440.32 440.32 440.32-197.632 440.32-440.32-197.632-440.32-440.32-440.32z m0 819.2c-208.896 0-378.88-169.984-378.88-378.88s169.984-378.88 378.88-378.88 378.88 169.984 378.88 378.88-169.984 378.88-378.88 378.88z",fill:t(r,0,"#333333")}),(0,s.jsx)("path",{d:"M542.72 261.12H481.28v220.16H261.12v61.44h220.16v220.16h61.44v-220.16h220.16V481.28h-220.16z",fill:t(r,1,"#333333")})]})};E.defaultProps={size:18};const N=E,A={display:"block"},B=e=>{let{size:n,color:r,style:o,...i}=e;const l=o?{...A,...o}:A;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...i,children:(0,s.jsx)("path",{d:"M384 896h-64v-70.4c0-15.2-10.4-28-24.8-31.2C159.2 768 64 644.8 64 496v-32h64v32c0 118.4 73.6 215.2 179.2 236 44.8 8.8 76.8 48 76.8 94.4v69.6zM704 896h-64v-70.4c0-45.6 32-85.6 76.8-94.4C822.4 711.2 896 614.4 896 496v-32h64v32c0 148.8-95.2 272-231.2 298.4-14.4 3.2-24.8 16-24.8 31.2v70.4zM512.8 640l-41.6-37.6c-147.2-133.6-244-208-244-316.8 0-88 68.8-156.8 156.8-156.8 49.6 0 97.6 23.2 128.8 60C544 152 592 128.8 641.6 128.8c88 0 156.8 68.8 156.8 156.8 0 108-96.8 183.2-244 316.8L512.8 640z",fill:t(r,0,"#333333")})})};B.defaultProps={size:18};const I=B,L={display:"block"},M=e=>{let{size:n,color:r,style:o,...i}=e;const l=o?{...L,...o}:L;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...i,children:(0,s.jsx)("path",{d:"M942.4615936 284.62787926c-14.30911886-14.12709945-37.31996786-14.05468217-51.48229632 0.21920654L517.97142983 661.27810333 139.75544149 286.45003606c-14.30911886-14.16232846-37.31996786-14.05468217-51.51948344 0.21920654-14.16232846 14.30911886-14.05468217 37.35519687 0.21920654 51.51948345l401.99014627 398.34974663c0.61847666 0.61847666 1.41897273 0.76526706 2.03940637 1.34655658 0.14483342 0.14483342 0.18201941 0.32685283 0.32685283 0.47364324 7.09877874 7.02636259 16.38375538 10.55911595 25.63154489 10.55911595 9.35739278 0 18.75001458-3.60516949 25.85075143-10.77636551l398.34974663-401.99014628C956.84312974 321.8382427 956.73548345 298.7921647 942.4615936 284.62787926z",fill:t(r,0,"#333333")})})};M.defaultProps={size:18};const q=M,D={display:"block"},W=e=>{let{size:n,color:r,style:o,...i}=e;const l=o?{...D,...o}:D;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...i,children:(0,s.jsx)("path",{d:"M81.5384064 739.37212074c14.30911886 14.12709945 37.31996786 14.05468217 51.48229632-0.21920654L506.02857017 362.72189667 884.24455851 737.54996394c14.30911886 14.16232846 37.31996786 14.05468217 51.51948344-0.21920654 14.16232846-14.30911886 14.05468217-37.35519687-0.21920654-51.51948345l-401.99014627-398.34974663c-0.61847666-0.61847666-1.41897273-0.76526706-2.03940637-1.34655658-0.14483342-0.14483342-0.18201941-0.32685283-0.32685282-0.47364324-7.09877874-7.02636259-16.38375538-10.55911595-25.6315449-10.55911595-9.35739278 0-18.75001458 3.60516949-25.85075143 10.77636551l-398.34974663 401.99014628C67.15687026 702.1617573 67.26451655 725.2078353 81.5384064 739.37212074z",fill:t(r,0,"#333333")})})};W.defaultProps={size:18};const _=W,V=e=>{let{name:n,...r}=e;switch(n){case"youhua":return(0,s.jsx)(l,{...r});case"dayi":return(0,s.jsx)(d,{...r});case"shengji":return(0,s.jsx)(x,{...r});case"tiaozheng":return(0,s.jsx)(j,{...r});case"gengxin":return(0,s.jsx)(v,{...r});case"wendang":return(0,s.jsx)(C,{...r});case"shanchu":return(0,s.jsx)(S,{...r});case"bug":return(0,s.jsx)(O,{...r});case"xinzeng":return(0,s.jsx)(N,{...r});case"fuwu":return(0,s.jsx)(I,{...r});case"down":return(0,s.jsx)(q,{...r});case"up":return(0,s.jsx)(_,{...r})}return null},R={label:"label_p8vM",icon:"icon_knQK"};function F(e){const{children:n}=e,r={"\u65b0\u589e":{icon:"xinzeng",bgColor:"#39b54a"},"\u4fee\u590d":{icon:"bug",bgColor:"#9c26b0"},"\u6587\u6863":{icon:"wendang",bgColor:"rgb(79, 147, 255)"},"\u66f4\u65b0":{icon:"gengxin",bgColor:"#0081ff"},"\u8c03\u6574":{icon:"tiaozheng",bgColor:"#333"},"\u5347\u7ea7":{icon:"shengji",bgColor:"#e03997"},"\u79fb\u9664":{icon:"shanchu",bgColor:"#666"},"\u7b54\u7591":{icon:"dayi",bgColor:"#bbb"},"\u4f18\u5316":{icon:"youhua",bgColor:"#38e550"}};return(0,s.jsxs)("label",{className:R.label,title:n,style:{backgroundColor:r[n].bgColor},children:[(0,s.jsx)(V,{name:r[n].icon,color:"white",size:14,className:R.icon})," ",n]})}},1151:(e,n,r)=>{r.d(n,{Z:()=>l,a:()=>i});var t=r(7294);const s={},o=t.createContext(s);function i(e){const n=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),t.createElement(o.Provider,{value:n},e.children)}}}]);