"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[969],{1971:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>t,metadata:()=>l,toc:()=>x});var o=r(5893),s=r(1151),i=r(510);const t={id:"dbcontext",title:"9.2 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587",sidebar_label:"9.2 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},c=void 0,l={id:"dbcontext",title:"9.2 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587",description:"\ud83d\udcdd \u6a21\u5757\u66f4\u65b0\u65e5\u5fd7",source:"@site/docs/dbcontext.mdx",sourceDirName:".",slug:"/dbcontext",permalink:"/docs/dbcontext",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/dbcontext.mdx",tags:[],version:"current",lastUpdatedBy:"\u767e\u5c0f\u50e7",lastUpdatedAt:1700452315,formattedLastUpdatedAt:"Nov 20, 2023",frontMatter:{id:"dbcontext",title:"9.2 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587",sidebar_label:"9.2 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},sidebar:"docs",previous:{title:"9.1 \u5165\u95e8\u7b80\u8981 \u2728",permalink:"/docs/dbcontext-start"},next:{title:"9.3 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668",permalink:"/docs/dbcontext-locator"}},d={},x=[{value:"9.2.1 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"921-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",level:2},{value:"9.2.2 AppDbContext
",id:"922-appdbcontext",level:2},{value:"9.2.3 AppDbContext
\u548c DbContext
\u533a\u522b",id:"923-appdbcontext-\u548c-dbcontext-\u533a\u522b",level:2},{value:"9.2.4 \u5982\u4f55\u5b9a\u4e49\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"924-\u5982\u4f55\u5b9a\u4e49\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",level:2},{value:"9.2.4.1 \u521b\u5efa\u9ed8\u8ba4\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"9241-\u521b\u5efa\u9ed8\u8ba4\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",level:3},{value:"9.2.4.2 \u521b\u5efa\u5176\u4ed6\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"9242-\u521b\u5efa\u5176\u4ed6\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",level:3},{value:"9.2.5 \u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32",id:"925-\u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32",level:2},{value:"9.2.5.1 \u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e",id:"9251-\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e",level:3},{value:"9.2.5.2 [AppDbContext]
\u65b9\u5f0f\u914d\u7f6e",id:"9252-appdbcontext-\u65b9\u5f0f\u914d\u7f6e",level:3},{value:"9.2.5.3 OnConfiguring
\u65b9\u5f0f\u914d\u7f6e",id:"9253-onconfiguring-\u65b9\u5f0f\u914d\u7f6e",level:3},{value:"9.2.5.4 \u5404\u7c7b\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u914d\u7f6e\u793a\u4f8b",id:"9254-\u5404\u7c7b\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u914d\u7f6e\u793a\u4f8b",level:3},{value:"9.2.6 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4e49\u4f4d\u7f6e",id:"926-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4e49\u4f4d\u7f6e",level:2},{value:"9.2.7 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6ce8\u518c",id:"927-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6ce8\u518c",level:2},{value:"9.2.8 \u81ea\u5b9a\u4e49\u9ad8\u7ea7\u6ce8\u518c",id:"928-\u81ea\u5b9a\u4e49\u9ad8\u7ea7\u6ce8\u518c",level:2},{value:"9.2.9 \u52a8\u6001\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61",id:"929-\u52a8\u6001\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61",level:2},{value:"9.2.10 \u5728\u540e\u53f0\u4efb\u52a1\u4e2d\u4f7f\u7528",id:"9210-\u5728\u540e\u53f0\u4efb\u52a1\u4e2d\u4f7f\u7528",level:2},{value:"9.2.11 AppDbContext
\u5168\u5c40\u914d\u7f6e\u5c5e\u6027",id:"9211-appdbcontext-\u5168\u5c40\u914d\u7f6e\u5c5e\u6027",level:2},{value:"9.2.12 \u914d\u7f6e\u5b9e\u4f53 \u61d2\u52a0\u8f7d
",id:"9212-\u914d\u7f6e\u5b9e\u4f53-\u61d2\u52a0\u8f7d",level:2},{value:"9.2.13 Db
\u9759\u6001\u7c7b\u83b7\u53d6\u4e0a\u4e0b\u6587",id:"9213-db-\u9759\u6001\u7c7b\u83b7\u53d6\u4e0a\u4e0b\u6587",level:2},{value:"9.2.14 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9214-\u53cd\u9988\u4e0e\u5efa\u8bae",level:2}];function a(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,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(r,{children:[(0,o.jsx)("summary",{children:"\ud83d\udcdd \u6a21\u5757\u66f4\u65b0\u65e5\u5fd7"}),(0,o.jsx)("div",{children:(0,o.jsx)("div",{children:(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.strong,{children:"\u65b0\u7279\u6027"})}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["\xa0",(0,o.jsx)(i.Z,{children:"\u65b0\u589e"})," ",(0,o.jsx)(n.code,{children:"[AppDbContext]"})," \u7279\u6027\u652f\u6301 ",(0,o.jsx)(n.code,{children:"UseSnakeCaseNaming"})," \u5c5e\u6027\u914d\u7f6e\u8868\u540d\u4f7f\u7528\u86c7\u5f62\u547d\u540d ",(0,o.jsx)("sup",{children:"4.9.1.5"})," ",(0,o.jsx)("sup",{children:"\u23f1\ufe0f2023.11.20"})," ",(0,o.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I8HGR2",children:"#I8HGR2"})," ",(0,o.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/pulls/863",children:"!863"})]}),"\n",(0,o.jsxs)(n.li,{children:["\xa0",(0,o.jsx)(i.Z,{children:"\u65b0\u589e"})," ",(0,o.jsx)(n.code,{children:"Db.GetNewDbContext()"})," \u591a\u4e2a\u91cd\u8f7d\u65b9\u6cd5\uff0c\u5b9e\u73b0\u7c7b\u4f3c ",(0,o.jsx)(n.code,{children:"new DbContext()"})," \u64cd\u4f5c ",(0,o.jsx)("sup",{children:"4.8.8.55"})," ",(0,o.jsx)("sup",{children:"\u23f1\ufe0f2023.11.09"})," ",(0,o.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/41576295473fefc47f6961154909a690d7c5ed58",children:"4157629"})]}),"\n"]}),"\n"]}),"\n"]})})})]}),"\n",(0,o.jsxs)(n.admonition,{title:"\u8fde\u63a5\u5b57\u7b26\u4e32\u914d\u7f6e\u6ce8\u610f\u4e8b\u9879",type:"warning",children:[(0,o.jsxs)(n.p,{children:["\u5982\u679c\u8fde\u63a5\u5b57\u7b26\u4e32\u662f\u914d\u7f6e\u5728\u81ea\u5b9a\u4e49\u7684 ",(0,o.jsx)(n.code,{children:".json"})," \u6587\u4ef6\u4e2d\uff0c\u90a3\u4e48\u5fc5\u987b\u5728 ",(0,o.jsx)(n.code,{children:"Visual Studio"})," \u4e2d\u914d\u7f6e ",(0,o.jsx)(n.code,{children:".json"})," \u53f3\u952e\u5c5e\u6027\uff0c\u8bbe\u7f6e ",(0,o.jsx)(n.code,{children:"\u590d\u5236"})," \u8f93\u51fa\u76ee\u5f55\u4e3a ",(0,o.jsx)(n.code,{children:"\u5982\u679c\u8f83\u65b0\u5219\u590d\u5236"}),"\uff0c\u751f\u6210\u64cd\u4f5c\u4e3a\uff1a",(0,o.jsx)(n.code,{children:"\u5185\u5bb9"}),"\u3002"]}),(0,o.jsx)(n.p,{children:"\u5426\u5219\u5c31\u4f1a\u63d0\u793a\u627e\u4e0d\u5230\u914d\u7f6e\u6216\u8fde\u63a5\u5b57\u7b26\u4e32\u7684\u9519\u8bef\u3002"})]}),"\n",(0,o.jsx)(n.h2,{id:"921-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:"9.2.1 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587"}),"\n",(0,o.jsx)(n.p,{children:"\u7b80\u5355\u6765\u8bf4\uff0c\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u662f\u8d1f\u8d23\u548c\u6570\u636e\u5e93\u4ea4\u4e92\u7684\u5bf9\u8c61\uff0c\u63d0\u4f9b\u7a0b\u5e8f\u5bf9\u6570\u636e\u5e93\u5b58\u53d6\u63d0\u4f9b\u4e86\u5927\u91cf\u7684\u65b9\u6cd5\u3002"}),"\n",(0,o.jsxs)(n.p,{children:["\u5728 ",(0,o.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u4e2d\uff0c\u9ed8\u8ba4\u96c6\u6210\u4e86\u5fae\u8f6f\u4eb2\u513f\u5b50\uff1a",(0,o.jsx)(n.code,{children:"EntityFramework Core"})," \uff0c\u4e5f\u5c31\u662f\u901a\u5e38\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6307\u7684\u662f ",(0,o.jsx)(n.code,{children:"DbContext"})," \u7c7b\u6216\u5b83\u7684\u5b9e\u73b0\u7c7b\u3002"]}),"\n",(0,o.jsxs)(n.h2,{id:"922-appdbcontext",children:["9.2.2 ",(0,o.jsx)(n.code,{children:"AppDbContext"})]}),"\n",(0,o.jsxs)(n.p,{children:["\u5728\u6211\u4eec\u5b9e\u9645\u9879\u76ee\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u4f7f\u7528 ",(0,o.jsx)(n.code,{children:"EFCore"})," \u63d0\u4f9b\u7684 ",(0,o.jsx)(n.code,{children:"DbContext"})," \u64cd\u4f5c\u5bf9\u8c61\u64cd\u4f5c\u6570\u636e\u5e93\u6709\u4e9b\u7e41\u7410\u548c\u590d\u6742\uff0c\u4e14\u9ed8\u8ba4\u4e0d\u5177\u5907\u8bfb\u5199\u5206\u79bb\u3001\u591a\u5e93\u7b49\u64cd\u4f5c\u529f\u80fd\u3002"]}),"\n",(0,o.jsxs)(n.p,{children:["\u6240\u4ee5\uff0c",(0,o.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u63d0\u4f9b\u4e86 ",(0,o.jsx)(n.code,{children:"AppDbContext"})," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u8be5\u4e0a\u4e0b\u6587\u7ee7\u627f\u81ea ",(0,o.jsx)(n.code,{children:"DbContext"}),"\u3002"]}),"\n",(0,o.jsx)(n.admonition,{title:"\u7279\u522b\u8bf4\u660e",type:"note",children:(0,o.jsxs)(n.p,{children:["\u540e\u7eed\u7ae0\u8282\uff0c\u7686\u91c7\u7528 ",(0,o.jsx)(n.code,{children:"EFCore"})," \u4ee3\u66ff ",(0,o.jsx)(n.code,{children:"EntityFramework Core"}),"\u3002"]})}),"\n",(0,o.jsxs)(n.h2,{id:"923-appdbcontext-\u548c-dbcontext-\u533a\u522b",children:["9.2.3 ",(0,o.jsx)(n.code,{children:"AppDbContext"})," \u548c ",(0,o.jsx)(n.code,{children:"DbContext"})," \u533a\u522b"]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"AppDbContext"})," \u7ee7\u627f\u81ea ",(0,o.jsx)(n.code,{children:"DbContext"}),"\uff0c\u5177\u5907 ",(0,o.jsx)(n.code,{children:"DbContext"})," \u6240\u6709\u529f\u80fd\u3002"]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"AppDbContext"})," \u652f\u6301\u591a\u6570\u636e\u5e93\u64cd\u4f5c\u6cdb\u578b\u7248\u672c\uff0c\u5982\uff1a",(0,o.jsx)(n.code,{children:"AppDbContext"})]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"AppDbContext"})," \u81ea\u52a8\u914d\u7f6e\u5b9e\u4f53\u4fe1\u606f\uff0c\u65e0\u9700\u5728 ",(0,o.jsx)(n.code,{children:"OnModelCreating"})," \u4e2d\u914d\u7f6e"]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"AppDbContext"})," \u652f\u6301\u5185\u7f6e\u591a\u79df\u6237\u652f\u6301"]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"AppDbContext"})," \u652f\u6301\u5168\u5c40\u6a21\u578b\u914d\u7f6e\u62e6\u622a\u5668"]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"AppDbContext"})," \u652f\u6301\u6570\u636e\u63d0\u4ea4\u66f4\u6539\u591a\u4e2a\u4e8b\u4ef6"]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"AppDbContext"})," \u63d0\u4f9b\u66f4\u52a0\u5f3a\u5927\u7684\u6a21\u578b\u64cd\u4f5c\u80fd\u529b\uff0c\u5982 ",(0,o.jsx)(n.code,{children:"Sql"})," \u64cd\u4f5c\uff0c\u8bfb\u5199\u5206\u79bb\u7b49"]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"AppDbContext"})," \u80fd\u591f\u5f97\u5230 ",(0,o.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u66f4\u591a\u7684\u529f\u80fd\u652f\u6301"]}),"\n"]}),"\n",(0,o.jsx)(n.h2,{id:"924-\u5982\u4f55\u5b9a\u4e49\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:"9.2.4 \u5982\u4f55\u5b9a\u4e49\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"}),"\n",(0,o.jsxs)(n.p,{children:["\u5728 ",(0,o.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u4e2d\u4e86\uff0c\u63d0\u4f9b\u4e86\u4e24\u79cd ",(0,o.jsx)(n.code,{children:"AppDbContext"})," \u5b9a\u4e49\u65b9\u5f0f\uff1a"]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"AppDbContext"})," \u64cd\u4f5c\u9ed8\u8ba4\u6570\u636e\u5e93"]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"AppDbContext"})," \u64cd\u4f5c N \u4e2a\u6570\u636e\u5e93"]}),"\n"]}),"\n",(0,o.jsxs)(n.p,{children:["\u5176\u4e2d ",(0,o.jsx)(n.code,{children:"AppDbContext"})," \u9ed8\u8ba4\u7ee7\u627f\u81ea ",(0,o.jsx)(n.code,{children:"AppDbContext"}),"\u3002"]}),"\n",(0,o.jsx)(n.p,{children:"\u4e0b\u9762\u662f\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u521b\u5efa\u7684\u591a\u4e2a\u4f8b\u5b50\uff1a"}),"\n",(0,o.jsx)(n.h3,{id:"9241-\u521b\u5efa\u9ed8\u8ba4\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:"9.2.4.1 \u521b\u5efa\u9ed8\u8ba4\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,6,12}",children:'using Furion.DatabaseAccessor;\r\nusing Microsoft.EntityFrameworkCore;\r\n\r\nnamespace Furion.EntityFramework.Core\r\n{\r\n [AppDbContext("\u8fde\u63a5\u5b57\u7b26\u4e32\u6216appsetting.json \u952e")]\r\n public class FurionDbContext : AppDbContext // \u7ee7\u627f AppDbContext<> \u7c7b\r\n {\r\n /// \r\n /// \u7ee7\u627f\u7236\u7c7b\u6784\u9020\u51fd\u6570\r\n /// \r\n /// \r\n public FurionDbContext(DbContextOptions options) : base(options)\r\n {\r\n }\r\n }\r\n}\n'})}),"\n",(0,o.jsx)(n.h3,{id:"9242-\u521b\u5efa\u5176\u4ed6\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:"9.2.4.2 \u521b\u5efa\u5176\u4ed6\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,6,12}",children:'using Furion.DatabaseAccessor;\r\nusing Microsoft.EntityFrameworkCore;\r\n\r\nnamespace Furion.EntityFramework.Core\r\n{\r\n [AppDbContext("\u8fde\u63a5\u5b57\u7b26\u4e32\u6216appsetting.json \u952e")]\r\n public class FurOtherDbContext : AppDbContext // \u7ee7\u627f AppDbContext<> \u7c7b\r\n {\r\n /// \r\n /// \u7ee7\u627f\u7236\u7c7b\u6784\u9020\u51fd\u6570\r\n /// \r\n /// \r\n public FurOtherDbContext(DbContextOptions options) : base(options)\r\n {\r\n }\r\n }\r\n}\n'})}),"\n",(0,o.jsx)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"important",children:(0,o.jsxs)(n.p,{children:["\u6240\u6709\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u90fd\u5e94\u8be5\u5728 ",(0,o.jsx)(n.code,{children:"Furion.EntityFramework.Core"})," \u9879\u76ee\u4e2d\u521b\u5efa\u3002\u53e6\u5916\u5982\u679c\u7cfb\u7edf\u7528\u5230\u4e86\u591a\u4e2a\u6570\u636e\u5e93\uff0c\u90a3\u4e48\u4ece\u7b2c\u4e8c\u4e2a\u5f00\u59cb\u5fc5\u987b\u6307\u5b9a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\u3002\u5173\u4e8e ",(0,o.jsx)(n.code,{children:"TDbContextLocator"})," \u5c06\u5728\u4e0b\u4e00\u7ae0\u8282 \u300a",(0,o.jsx)(n.a,{href:"dbcontext-locator",children:"9.3 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668"}),"\u300b\u9610\u8ff0\u3002"]})}),"\n",(0,o.jsx)(n.h2,{id:"925-\u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32",children:"9.2.5 \u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32"}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u63d0\u4f9b\u591a\u79cd\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u914d\u7f6e\u65b9\u5f0f\uff1a"]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e\uff1a",(0,o.jsx)(n.code,{children:'AddDbPool("\u8fde\u63a5\u5b57\u7b26\u4e32")'})," \u65b9\u5f0f"]}),"\n",(0,o.jsxs)(n.li,{children:["\u4f7f\u7528 ",(0,o.jsx)(n.code,{children:'[AppDbContext("\u8fde\u63a5\u5b57\u7b26\u4e32/Key")]'})," \u7279\u6027\u65b9\u5f0f\uff08\u53ea\u5728 ",(0,o.jsx)(n.code,{children:"AppDbContext \u5b9e\u73b0\u7c7b\u6709\u6548"}),"\uff09",(0,o.jsx)(n.strong,{children:"\u63a8\u8350"})]}),"\n",(0,o.jsxs)(n.li,{children:["\u901a\u8fc7\u91cd\u5199 ",(0,o.jsx)(n.code,{children:"OnConfiguring(DbContextOptionsBuilder optionsBuilder)"})," \u914d\u7f6e"]}),"\n"]}),"\n",(0,o.jsx)(n.h3,{id:"9251-\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e",children:"9.2.5.1 \u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-cs",metastring:'showLineNumbers {12-19} title="Furion.EntityFramework.Core\\Startup.cs"',children:'using Furion.DependencyInjection;\r\nusing Microsoft.Extensions.DependencyInjection;\r\n\r\nnamespace Furion.EntityFramework.Core\r\n{\r\n [AppStartup(600)]\r\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\r\n {\r\n public void ConfigureServices(IServiceCollection services)\r\n {\r\n // \u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u652f\u6301N\u4e2a\u6570\u636e\u5e93\r\n services.AddDatabaseAccessor(options =>\r\n {\r\n // \u914d\u7f6e\u9ed8\u8ba4\u6570\u636e\u5e93\r\n options.AddDbPool(DbProvider.SqlServer, connectionMetadata:"\u8fde\u63a5\u5b57\u7b26\u4e32");\r\n\r\n // \u914d\u7f6e\u591a\u4e2a\u6570\u636e\u5e93\uff0c\u591a\u4e2a\u6570\u636e\u5e93\u5fc5\u987b\u6307\u5b9a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\r\n options.AddDbPool(DbProvider.Sqlite, connectionMetadata:"\u8fde\u63a5\u5b57\u7b26\u4e32");\r\n });\r\n }\r\n }\r\n}\n'})}),"\n",(0,o.jsxs)(n.admonition,{title:"\u65b0\u7248 MySQL \u6ce8\u610f",type:"caution",children:[(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"MySQL"})," \u5728\u65b0\u7248\u672c\u5305\u4e2d\u6ce8\u518c\u6709\u6240\u4fee\u6539\uff0c\u6240\u4ee5\u6ce8\u518c\u65b9\u5f0f\u4e3a\uff1a"]}),(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'services.AddDatabaseAccessor(options =>\r\n{\r\n options.AddDbPool($"{DbProvider.MySql}@8.0.22");\r\n});\n'})})]}),"\n",(0,o.jsxs)(n.h3,{id:"9252-appdbcontext-\u65b9\u5f0f\u914d\u7f6e",children:["9.2.5.2 ",(0,o.jsx)(n.code,{children:"[AppDbContext]"})," \u65b9\u5f0f\u914d\u7f6e"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,6}",children:'using Furion.DatabaseAccessor;\r\nusing Microsoft.EntityFrameworkCore;\r\n\r\nnamespace Furion.EntityFramework.Core\r\n{\r\n [AppDbContext("DbConnectionString")] // \u652f\u6301 `appsetting.json` \u540d\u6216 \u8fde\u63a5\u5b57\u7b26\u4e32\r\n public class FurionDbContext : AppDbContext\r\n {\r\n /// \r\n /// \u7ee7\u627f\u7236\u7c7b\u6784\u9020\u51fd\u6570\r\n /// \r\n /// \r\n public FurionDbContext(DbContextOptions options) : base(options)\r\n {\r\n }\r\n }\r\n}\n'})}),"\n",(0,o.jsx)(n.admonition,{title:"\u5c0f\u63d0\u793a",type:"tip",children:(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"Furion"})," \u63a8\u8350\u4f7f\u7528\u6b64\u65b9\u5f0f\u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u3002"]})}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.strong,{children:(0,o.jsx)(n.code,{children:"[AppDbContext]"})})," \u5185\u7f6e\u5c5e\u6027\uff1a"]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"ConnectionMetadata"}),"\uff1a\u652f\u6301\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u914d\u7f6e\u6587\u4ef6\u7684 ",(0,o.jsx)(n.code,{children:"ConnectionStrings"})," \u4e2d\u7684 ",(0,o.jsx)(n.code,{children:"Key"})," \u6216\u914d\u7f6e\u6587\u4ef6\u7684\u5b8c\u6574\u7684\u914d\u7f6e\u8def\u5f84\uff0c\u5982\u679c\u662f\u5185\u5b58\u6570\u636e\u5e93\uff0c\u5219\u4e3a\u6570\u636e\u5e93\u540d\u79f0\u3002"]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"TablePrefix"}),"\uff1a\u5f53\u524d\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u8868\u7edf\u4e00\u524d\u7f00"]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"TableSuffix"}),"\uff1a\u5f53\u524d\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u8868\u7edf\u4e00\u540e\u7f00"]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"ProviderName"}),"\uff1a\u914d\u7f6e\u6570\u636e\u5e93\u63d0\u4f9b\u5668\u7c7b\u578b\uff0c\u4f20\u5165 ",(0,o.jsx)(n.code,{children:"DbProvider.Xxx"})]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"Mode"}),"\uff1a\u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6a21\u5f0f\uff0c",(0,o.jsx)(n.code,{children:"DbContextMode"})," \u679a\u4e3e\u7c7b\u578b\uff0c\u53d6\u503c\uff1a","\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"Cached"}),"\uff1a\u7f13\u5b58\u6a21\u578b\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u9ed8\u8ba4\u503c"]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"Dynamic"}),"\uff1a\u52a8\u6001\u6a21\u578b\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"]}),"\n"]}),"\n"]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"SlaveDbContextLocators"}),"\uff1a\u4e3b\u4ece\u5e93\u914d\u7f6e\uff0c\u8bbe\u7f6e\u591a\u4e2a\u4ece\u5e93\u5b9a\u4f4d\u5668\uff0c",(0,o.jsx)(n.code,{children:"Type[]"})," \u7c7b\u578b"]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"UseSnakeCaseNaming"}),"\uff1a\u8868\u540d\u4f7f\u7528\u86c7\u5f62\u547d\u540d\uff0c",(0,o.jsx)(n.code,{children:"bool"})," \u7c7b\u578b\uff0c\u9ed8\u8ba4 ",(0,o.jsx)(n.code,{children:"false"}),"\uff0c",(0,o.jsx)(n.code,{children:"Furion 4.9.1.5+"})," \u7248\u672c\u652f\u6301"]}),"\n"]}),"\n",(0,o.jsxs)(n.h3,{id:"9253-onconfiguring-\u65b9\u5f0f\u914d\u7f6e",children:["9.2.5.3 ",(0,o.jsx)(n.code,{children:"OnConfiguring"})," \u65b9\u5f0f\u914d\u7f6e"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {16-20}",children:'using Furion.DatabaseAccessor;\r\nusing Microsoft.EntityFrameworkCore;\r\n\r\nnamespace Furion.EntityFramework.Core\r\n{\r\n public class FurionDbContext : AppDbContext\r\n {\r\n /// \r\n /// \u7ee7\u627f\u7236\u7c7b\u6784\u9020\u51fd\u6570\r\n /// \r\n /// \r\n public FurionDbContext(DbContextOptions options) : base(options)\r\n {\r\n }\r\n\r\n protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)\r\n {\r\n base.OnConfiguring(optionsBuilder);\r\n\r\n optionsBuilder.UseSqlServer("\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32");\r\n }\r\n }\r\n}\n'})}),"\n",(0,o.jsxs)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"important",children:[(0,o.jsxs)(n.p,{children:["\u8fd9\u4e09\u79cd\u65b9\u5f0f\u53ef\u4ee5\u540c\u65f6\u4f7f\u7528\uff0c\u4f46\u662f\u6709\u4f18\u5148\u7ea7\uff1a",(0,o.jsx)(n.code,{children:"[AppDbContext]"})," -> ",(0,o.jsx)(n.code,{children:"\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e"})," -> ",(0,o.jsx)(n.code,{children:"OnConfiguring"}),"\uff08\u4f4e\u5230\u9ad8\uff09"]}),(0,o.jsxs)(n.p,{children:["\u4e5f\u5c31\u662f ",(0,o.jsx)(n.code,{children:"OnConfiguring"})," \u914d\u7f6e\u4f1a\u8986\u76d6 ",(0,o.jsx)(n.code,{children:"\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e"})," \u914d\u7f6e\uff0c",(0,o.jsx)(n.code,{children:"\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e"})," \u914d\u7f6e\u4f1a\u8986\u76d6 ",(0,o.jsx)(n.code,{children:"[AppDbContext]"})," \u914d\u7f6e\u6240\u914d\u7f6e\u7684\u8fde\u63a5\u5b57\u7b26\u4e32\u3002"]})]}),"\n",(0,o.jsx)(n.h3,{id:"9254-\u5404\u7c7b\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u914d\u7f6e\u793a\u4f8b",children:"9.2.5.4 \u5404\u7c7b\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u914d\u7f6e\u793a\u4f8b"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"Sqlite"}),"\uff1a",(0,o.jsx)(n.code,{children:"Data Source=./Furion.db"})]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"MySql"}),"\uff1a",(0,o.jsx)(n.code,{children:"Data Source=localhost;Database=Furion;User ID=root;Password=000000;pooling=true;port=3306;sslmode=none;CharSet=utf8;"})]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"SqlServer"}),"\uff1a",(0,o.jsx)(n.code,{children:"Server=localhost;Database=Furion;User=sa;Password=000000;MultipleActiveResultSets=True;"})]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"Oracle"}),"\uff1a",(0,o.jsx)(n.code,{children:"User Id=orcl;Password=orcl;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl)))"})]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"PostgreSQL"}),"\uff1a",(0,o.jsx)(n.code,{children:"PORT=5432;DATABASE=postgres;HOST=127.0.0.1;PASSWORD=postgres;USER ID=postgres;"})]}),"\n"]}),"\n",(0,o.jsx)(n.h2,{id:"926-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4e49\u4f4d\u7f6e",children:"9.2.6 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4e49\u4f4d\u7f6e"}),"\n",(0,o.jsx)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"important",children:(0,o.jsxs)(n.p,{children:["\u5728 ",(0,o.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u4e2d\uff0c\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u9700\u5b9a\u4e49\u5728 ",(0,o.jsx)(n.code,{children:"Furion.EntityFramework.Core"})," \u4e2d\uff0c\u4e14\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u90fd\u5fc5\u987b\u62e5\u6709\u552f\u4e00\u7684 ",(0,o.jsx)(n.code,{children:"DbContextLocator"})," \u5b9a\u4f4d\u5668"]})}),"\n",(0,o.jsx)(n.h2,{id:"927-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6ce8\u518c",children:"9.2.7 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6ce8\u518c"}),"\n",(0,o.jsx)(n.p,{children:"\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u914d\u7f6e\u597d\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u540e\uff0c\u9700\u8981\u6ce8\u518c\u8be5\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u5e76\u6307\u5b9a\u6570\u636e\u5e93\u7c7b\u578b\uff0c\u5982\uff1a"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-cs",metastring:'showLineNumbers {11-13} title="Furion\\framework\\Furion.EntityFramework.Core\\FurEntityFrameworkCoreStartup.cs"',children:"using Furion.DatabaseAccessor;\r\nusing Microsoft.Extensions.DependencyInjection;\r\n\r\nnamespace Furion.EntityFramework.Core\r\n{\r\n [AppStartup(600)]\r\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\r\n {\r\n public void ConfigureServices(IServiceCollection services)\r\n {\r\n services.AddDatabaseAccessor(options =>\r\n {\r\n options.AddDbPool(DbProvider.Sqlite);\r\n });\r\n }\r\n }\r\n}\n"})}),"\n",(0,o.jsxs)(n.p,{children:["\u5982\u679c\u6709\u591a\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\uff0c",(0,o.jsx)(n.strong,{children:"\u90a3\u4e48\u4ece\u7b2c\u4e8c\u4e2a\u8d77\uff0c\u5c31\u9700\u8981\u7ed1\u5b9a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668"}),"\uff0c\u5982\uff1a"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"options.AddDbPool(DbProvider.Sqlite); // \u7b2c\u4e00\u4e2a\u6570\u636e\u5e93\r\n\r\noptions.AddDbPool(DbProvider.SqlServer); // \u7b2c\u4e8c\u4e2a\u6570\u636e\u5e93\r\n\r\noptions.AddDbPool(DbProvider.SqlServer); // \u7b2c\u4e09\u4e2a\u6570\u636e\u5e93\n"})}),"\n",(0,o.jsx)(n.h2,{id:"928-\u81ea\u5b9a\u4e49\u9ad8\u7ea7\u6ce8\u518c",children:"9.2.8 \u81ea\u5b9a\u4e49\u9ad8\u7ea7\u6ce8\u518c"}),"\n",(0,o.jsxs)(n.p,{children:["\u5728 ",(0,o.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u4e2d\uff0c\u4e3a\u4e86\u80fd\u591f\u5b9e\u73b0\u6570\u636e\u5e93\u7684\u7b80\u5355\u4f7f\u7528\u8fdb\u884c\u4e86\u6ce8\u518c\u5c01\u88c5\uff0c\u4f46\u6709\u4e9b\u65f6\u5019\uff0c\u6211\u4eec\u53ef\u80fd\u9700\u8981\u6dfb\u52a0\u66f4\u591a\u914d\u7f6e\uff0c\u8fd9\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u539f\u751f\u81ea\u5b9a\u4e49\u914d\u7f6e\u65b9\u5f0f\uff0c\u5982\uff1a"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddDatabaseAccessor(options =>\r\n{\r\n // \u81ea\u5b9a\u4e49\u539f\u751f\u914d\u7f6e\r\n options.AddDb((services, builder) =>\r\n {\r\n builder.UseSqlite(...);\r\n }\r\n});\n"})}),"\n",(0,o.jsxs)(n.admonition,{title:"\u5c0f\u77e5\u8bc6",type:"tip",children:[(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u63d0\u4f9b\u4e86\u5feb\u901f\u89e3\u6790\u8fde\u63a5\u5b57\u7b26\u4e32\u7684\u9759\u6001\u65b9\u6cd5\uff0c\u81ea\u52a8\u6839\u636e\u540d\u79f0\u8bfb\u53d6\u914d\u7f6e\uff0c\u81ea\u52a8\u89e3\u6790 ",(0,o.jsx)(n.code,{children:'[AppContext("...")]'})," \u4fe1\u606f\uff0c\u5982\uff1a"]}),(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"// \u83b7\u53d6\u8fde\u63a5\u5b57\u7b26\u4e32\r\nvar connStr = DbProvider.GetConnectionString(/*\u8fd9\u91cc\u53ef\u5199\u53ef\u4e0d\u5199*/);\r\n\r\noptions.AddDb((services, builder) =>\r\n{\r\n builder.UseSqlite(connStr, ...);\r\n}\n"})})]}),"\n",(0,o.jsx)(n.h2,{id:"929-\u52a8\u6001\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61",children:"9.2.9 \u52a8\u6001\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61"}),"\n",(0,o.jsxs)(n.p,{children:["\u5728 ",(0,o.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u4e2d\uff0c\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u662f\u5b9a\u4e49\u5728 ",(0,o.jsx)(n.code,{children:"Furion.EntityFramework.Core"})," \u9879\u76ee\u5c42\uff0c\u5e76\u4e14\u8be5\u5c42\u4e0d\u88ab ",(0,o.jsx)(n.code,{children:"Furion.Application"})," \u548c ",(0,o.jsx)(n.code,{children:"Furion.Core"})," \u7b49\u5c42\u5f15\u7528\u3002"]}),"\n",(0,o.jsxs)(n.p,{children:["\u6240\u4ee5\u5c31\u4e0d\u80fd\u76f4\u63a5\u5728 ",(0,o.jsx)(n.code,{children:"Furion.Application"})," \u9879\u76ee\u5c42\u76f4\u63a5\u4f7f\u7528 ",(0,o.jsx)(n.code,{children:"Furion.EntityFramework.Core"})," \u5b9a\u4e49\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u3002"]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"Furion"})," \u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u63d0\u4f9b\u4e86\u4e24\u79cd\u65b9\u5f0f\u5904\u7406\uff1a"]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"repository.Context"})," \uff1a\u5f53\u524d\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61\uff0c\u8fd4\u56de\u662f ",(0,o.jsx)(n.code,{children:"DbContext"})," \u62bd\u8c61\u7c7b\u578b"]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"repository.DynamicContext"}),"\uff1a\u5f53\u524d\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61\uff0c\u8fd4\u56de\u7684\u662f ",(0,o.jsx)(n.code,{children:"dynamic"})," \u7c7b\u578b"]}),"\n"]}),"\n",(0,o.jsxs)(n.p,{children:["\u5982\u679c\u4f60\u53ea\u662f\u60f3\u4f7f\u7528 ",(0,o.jsx)(n.code,{children:"DbContext"})," \u7684\u529f\u80fd\uff0c\u76f4\u63a5\u4f7f\u7528 ",(0,o.jsx)(n.code,{children:"repository.Context"})," \u5373\u53ef\uff0c\u5982\uff1a"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"repository.Context.SaveChanges();\n"})}),"\n",(0,o.jsxs)(n.p,{children:["\u5982\u679c\u4f60\u60f3\u80fd\u591f\u83b7\u53d6\u5177\u4f53\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u7c7b\u578b\uff0c\u5982 ",(0,o.jsx)(n.code,{children:"MyDbContext"}),"\uff0c\u90a3\u4e48\u4f7f\u7528 ",(0,o.jsx)(n.code,{children:"repository.DynamicContext"})," \u5c31\u53ef\u4ee5\u83b7\u53d6\u5230\u5177\u4f53\u7684 ",(0,o.jsx)(n.code,{children:"MyDbContext"})," \u7c7b\u578b\u3002\u5982\uff1a"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"var persons = repository.DynamicContext.Persons.Find(1);\r\nvar users = repository.DynamicContext.Users;\n"})}),"\n",(0,o.jsxs)(n.p,{children:["\u8fd9\u6837\u5c31\u53ef\u4ee5\u76f4\u63a5\u64cd\u4f5c ",(0,o.jsx)(n.code,{children:"MyDbContext"})," \u5b9a\u4e49\u7684\u5c5e\u6027\u548c\u65b9\u6cd5\u4e86\u3002"]}),"\n",(0,o.jsx)(n.h2,{id:"9210-\u5728\u540e\u53f0\u4efb\u52a1\u4e2d\u4f7f\u7528",children:"9.2.10 \u5728\u540e\u53f0\u4efb\u52a1\u4e2d\u4f7f\u7528"}),"\n",(0,o.jsxs)(n.p,{children:["\u7531\u4e8e ",(0,o.jsx)(n.code,{children:"DbContext"})," \u9ed8\u8ba4\u6ce8\u518c\u4e3a ",(0,o.jsx)(n.code,{children:"Scoped"})," \u751f\u5b58\u5468\u671f\uff0c\u6240\u4ee5\u5728\u540e\u53f0\u4efb\u52a1\u4e2d\u4f7f\u7528 ",(0,o.jsx)(n.code,{children:"IServiceScopeFactory"})," \u83b7\u53d6\u6240\u6709\u670d\u52a1\uff0c\u5982\uff1a"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {8-9,19,21,24}",children:'public class JobService : BackgroundService\r\n{\r\n // \u65e5\u5fd7\u5bf9\u8c61\r\n private readonly ILogger _logger;\r\n\r\n // \u670d\u52a1\u5de5\u5382\r\n private readonly IServiceScopeFactory _scopeFactory;\r\n public JobService(ILogger logger\r\n , IServiceScopeFactory scopeFactory)\r\n {\r\n _logger = logger;\r\n _scopeFactory = scopeFactory;\r\n }\r\n\r\n protected override Task ExecuteAsync(CancellationToken stoppingToken)\r\n {\r\n _logger.LogInformation("\u5199\u65e5\u5fd7~~");\r\n\r\n using (var scope = _scopeFactory.CreateScope())\r\n {\r\n var services = scope.ServiceProvider;\r\n\r\n // \u83b7\u53d6\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\r\n var dbContext = Db.GetDbContext(services);\r\n\r\n // \u83b7\u53d6\u4ed3\u50a8\r\n var repository = Db.GetRepository(services);\r\n\r\n // \u89e3\u6790\u5176\u4ed6\u670d\u52a1\r\n var otherService = services.GetService();\r\n }\r\n\r\n return Task.CompletedTask;\r\n }\r\n}\n'})}),"\n",(0,o.jsx)(n.admonition,{title:"\u6570\u636e\u5e93\u64cd\u4f5c\u6ce8\u610f",type:"important",children:(0,o.jsxs)(n.p,{children:["\u5982\u679c\u4f5c\u7528\u57df\u4e2d\u5bf9",(0,o.jsx)(n.strong,{children:"\u6570\u636e\u5e93\u6709\u4efb\u4f55\u53d8\u66f4\u64cd\u4f5c"}),"\uff0c\u9700\u624b\u52a8\u8c03\u7528 ",(0,o.jsx)(n.code,{children:"SaveChanges"})," \u6216\u5e26 ",(0,o.jsx)(n.code,{children:"Now"})," \u7ed3\u5c3e\u7684\u65b9\u6cd5\u3002\u4e5f\u53ef\u4ee5\u4f7f\u7528 ",(0,o.jsx)(n.code,{children:"Scoped.CreateUow(handler)"})," \u4ee3\u66ff\u3002"]})}),"\n",(0,o.jsxs)(n.h2,{id:"9211-appdbcontext-\u5168\u5c40\u914d\u7f6e\u5c5e\u6027",children:["9.2.11 ",(0,o.jsx)(n.code,{children:"AppDbContext"})," \u5168\u5c40\u914d\u7f6e\u5c5e\u6027"]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"InsertOrUpdateIgnoreNullValues"}),"\uff1a\u65b0\u589e\u6216\u66f4\u65b0\u5ffd\u7565\u7a7a\u503c\uff0c\u9ed8\u8ba4 ",(0,o.jsx)(n.code,{children:"false"}),"\uff0c",(0,o.jsx)(n.strong,{children:"\u5728\u6784\u9020\u51fd\u6570\u4e2d\u914d\u7f6e"})]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"EnabledEntityStateTracked"}),"\uff1a\u542f\u7528\u5b9e\u4f53\u8ddf\u8e2a\uff0c\u9ed8\u8ba4 ",(0,o.jsx)(n.code,{children:"true"}),"\uff0c",(0,o.jsx)(n.strong,{children:"\u5728\u6784\u9020\u51fd\u6570\u4e2d\u914d\u7f6e"})]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"EnabledEntityChangedListener"}),"\uff1a\u542f\u7528\u5b9e\u4f53\u6570\u636e\u66f4\u6539\u76d1\u542c\uff0c\u9ed8\u8ba4 ",(0,o.jsx)(n.code,{children:"false"}),"\uff0c",(0,o.jsx)(n.strong,{children:"\u5728\u6784\u9020\u51fd\u6570\u4e2d\u914d\u7f6e"})]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"Tenant"}),"\uff1a\u9ed8\u8ba4\u5185\u7f6e\u591a\u79df\u6237"]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"FailedAutoRollback"}),"\uff1a\u662f\u5426\u542f\u7528\u4fdd\u5b58\u5931\u8d25\u540e\u4e8b\u52a1\u81ea\u52a8\u56de\u6eda\uff0c\u9ed8\u8ba4 ",(0,o.jsx)(n.code,{children:"true"}),"\uff0c\u53ef\u4ee5\u5728\u4efb\u4f55\u5730\u65b9\u914d\u7f6e"]}),"\n"]}),"\n",(0,o.jsxs)(n.h2,{id:"9212-\u914d\u7f6e\u5b9e\u4f53-\u61d2\u52a0\u8f7d",children:["9.2.12 \u914d\u7f6e\u5b9e\u4f53 ",(0,o.jsx)(n.code,{children:"\u61d2\u52a0\u8f7d"})]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["\u7b2c\u4e00\u6b65\uff1a\u5b89\u88c5 ",(0,o.jsx)(n.code,{children:"EFCore"})," \u62d3\u5c55\u5305"]}),"\n"]}),"\n",(0,o.jsxs)(n.p,{children:["\u5728\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4e49\u6240\u5728\u7684\u5c42\u5b89\u88c5 ",(0,o.jsx)(n.code,{children:"Microsoft.EntityFrameworkCore.Proxies"})," \u62d3\u5c55\u5305"]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["\u7b2c\u4e8c\u6b65\uff1a\u91c7\u7528 ",(0,o.jsx)(n.code,{children:"AddDb"})," \u65b9\u5f0f\u6ce8\u518c"]}),"\n"]}),"\n",(0,o.jsxs)(n.p,{children:["\u786e\u4fdd\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u91c7\u7528 ",(0,o.jsx)(n.code,{children:"AddDb"})," \u6ce8\u518c\u800c\u975e ",(0,o.jsx)(n.code,{children:"AddDbPool"}),"\u3002"]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["\u7b2c\u4e09\u6b65\uff1a\u91cd\u5199 ",(0,o.jsx)(n.code,{children:"OnConfiguring"})," \u65b9\u6cd5"]}),"\n"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {13,15}",children:'using Furion.DatabaseAccessor;\r\nusing Microsoft.EntityFrameworkCore;\r\n\r\nnamespace Furion.EntityFramework.Core\r\n{\r\n [AppDbContext("Sqlite3ConnectionString", DbProvider.Sqlite)]\r\n public class DefaultDbContext : AppDbContext\r\n {\r\n public DefaultDbContext(DbContextOptions options) : base(options)\r\n {\r\n }\r\n\r\n protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)\r\n {\r\n optionsBuilder.UseLazyLoadingProxies()\r\n .UseSqlite(DbProvider.GetConnectionString());\r\n\r\n base.OnConfiguring(optionsBuilder);\r\n }\r\n }\r\n}\n'})}),"\n",(0,o.jsx)(n.admonition,{title:"\u5c0f\u77e5\u8bc6",type:"note",children:(0,o.jsxs)(n.p,{children:["\u66f4\u591a ",(0,o.jsx)(n.code,{children:"EFCore"})," \u61d2\u52a0\u8f7d\u53ef\u67e5\u770b ",(0,o.jsx)(n.strong,{children:(0,o.jsx)(n.a,{href:"https://docs.microsoft.com/zh-cn/ef/core/querying/related-data/lazy",children:"\u3010EFCore - \u5ef6\u8fdf\u52a0\u8f7d\u3011"})})," \u6587\u6863\u3002"]})}),"\n",(0,o.jsxs)(n.h2,{id:"9213-db-\u9759\u6001\u7c7b\u83b7\u53d6\u4e0a\u4e0b\u6587",children:["9.2.13 ",(0,o.jsx)(n.code,{children:"Db"})," \u9759\u6001\u7c7b\u83b7\u53d6\u4e0a\u4e0b\u6587"]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"Db"})," \u9759\u6001\u7c7b\u63d0\u4f9b\u4e86\u591a\u79cd\u83b7\u53d6 ",(0,o.jsx)(n.code,{children:"DbContext"})," \u4e0a\u4e0b\u6587\u7684\u65b9\u6cd5\uff0c\u5982\uff1a"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,5-6,9,12-13}",children:"// \u83b7\u53d6\u9ed8\u8ba4\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\r\nvar dbContext = Db.GetDbContext();\r\n\r\n// \u83b7\u53d6\u5b9a\u4f4d\u5668\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\r\nvar locatorDbContext = Db.GetDbContext();\r\nvar locatorDbContext2 = Db.GetDbContext(typeof(TDbContextLocator));\r\n\r\n// \u521b\u5efa\u65b0\u7684\u9ed8\u8ba4\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff08\u76f8\u5f53\u4e8e new YourDbContext\uff09\r\nusing var dbContext = Db.GetNewDbContext(); // \u522b\u5fd8\u8bb0 using\uff0cFurion 4.8.8.55+ \u7248\u672c\u6709\u6548\r\n\r\n// \u521b\u5efa\u65b0\u7684\u5b9a\u4f4d\u5668\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff08\u76f8\u5f53\u4e8e new YourDbContext\uff09\r\nusing var locatorDbContext = Db.GetNewDbContext(); // \u522b\u5fd8\u8bb0 using\uff0cFurion 4.8.8.55+ \u7248\u672c\u6709\u6548\r\nusing var locatorDbContext2 = Db.GetNewDbContext(typeof(TDbContextLocator)); // \u522b\u5fd8\u8bb0 using\uff0cFurion 4.8.8.55+ \u7248\u672c\u6709\u6548\n"})}),"\n",(0,o.jsxs)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"caution",children:[(0,o.jsxs)(n.p,{children:["\u9ed8\u8ba4\u60c5\u51b5\u4e0b ",(0,o.jsx)(n.code,{children:"Db.GetDbContext(...)"})," \u521b\u5efa\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u7684\u4f5c\u7528\u57df\u548c ",(0,o.jsx)(n.code,{children:"Web"})," \u76f8\u540c\uff0c",(0,o.jsxs)(n.strong,{children:["\u5982\u679c\u60a8\u5728\u540e\u53f0\u7ebf\u7a0b\u6216\u591a\u7ebf\u7a0b\u4e2d\u4f7f\u7528\uff0c\u90a3\u4e48\u5fc5\u987b\u4f20\u5165\u7b2c\u4e8c\u4e2a ",(0,o.jsx)(n.code,{children:"serviceProvider"})," \u53c2\u6570\u3002"]})]}),(0,o.jsx)(n.p,{children:(0,o.jsxs)(n.strong,{children:["\u4e5f\u53ef\u4ee5\u901a\u8fc7 ",(0,o.jsx)(n.code,{children:"Db.GetNewDbContext(...)"})," \u7684\u65b9\u5f0f\u83b7\u53d6\u4e00\u4e2a\u65b0\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u4f46\u662f\u9700\u8981\u624b\u52a8 ",(0,o.jsx)(n.code,{children:"using"})," \u91ca\u653e\u3002"]})})]}),"\n",(0,o.jsx)(n.h2,{id:"9214-\u53cd\u9988\u4e0e\u5efa\u8bae",children:"9.2.14 \u53cd\u9988\u4e0e\u5efa\u8bae"}),"\n",(0,o.jsx)(n.admonition,{title:"\u4e0e\u6211\u4eec\u4ea4\u6d41",type:"note",children:(0,o.jsxs)(n.p,{children:["\u7ed9 Furion \u63d0 ",(0,o.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/new?issue",children:"Issue"}),"\u3002"]})}),"\n",(0,o.jsx)(n.hr,{}),"\n",(0,o.jsx)(n.admonition,{title:"\u4e86\u89e3\u66f4\u591a",type:"note",children:(0,o.jsxs)(n.p,{children:["\u60f3\u4e86\u89e3\u66f4\u591a ",(0,o.jsx)(n.code,{children:"\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"})," \u77e5\u8bc6\u53ef\u67e5\u9605 ",(0,o.jsx)(n.a,{href:"https://docs.microsoft.com/zh-cn/ef/core/miscellaneous/configuring-dbcontext",children:"EF Core - \u914d\u7f6e DbContext"})," \u7ae0\u8282\u3002"]})})]})}function h(e={}){const{wrapper:n}={...(0,s.a)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(a,{...e})}):a(e)}},510:(e,n,r)=>{r.d(n,{Z:()=>R});r(7294);const o=(e,n,r)=>e?"string"==typeof e?e:e[n]||r:r;var s=r(5893);const i={display:"block"},t=e=>{let{size:n,color:r,style:t,...c}=e;const l=t?{...i,...t}:i;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...c,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:o(r,0,"#333333")})})};t.defaultProps={size:18};const c=t,l={display:"block"},d=e=>{let{size:n,color:r,style:i,...t}=e;const c=i?{...l,...i}:l;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:c,...t,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:o(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:o(r,1,"#333333")})]})};d.defaultProps={size:18};const x=d,a={display:"block"},h=e=>{let{size:n,color:r,style:i,...t}=e;const c=i?{...a,...i}:a;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:c,...t,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:o(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:o(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:o(r,2,"#333333")})]})};h.defaultProps={size:18};const p=h,j={display:"block"},u=e=>{let{size:n,color:r,style:i,...t}=e;const c=i?{...j,...i}:j;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:c,...t,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:o(r,0,"#333333")})})};u.defaultProps={size:18};const b=u,C={display:"block"},D=e=>{let{size:n,color:r,style:i,...t}=e;const c=i?{...C,...i}:C;return(0,s.jsx)("svg",{viewBox:"0 0 1172 1024",width:n+"px",height:n+"px",style:c,...t,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:o(r,0,"#333333")})})};D.defaultProps={size:18};const g=D,v={display:"block"},m=e=>{let{size:n,color:r,style:i,...t}=e;const c=i?{...v,...i}:v;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:c,...t,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:o(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:o(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:o(r,2,"#333333")})]})};m.defaultProps={size:18};const y=m,F={display:"block"},f=e=>{let{size:n,color:r,style:i,...t}=e;const c=i?{...F,...i}:F;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:c,...t,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:o(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:o(r,1,"#333333")})]})};f.defaultProps={size:18};const S=f,w={display:"block"},A=e=>{let{size:n,color:r,style:i,...t}=e;const c=i?{...w,...i}:w;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:c,...t,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:o(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:o(r,1,"#333333")})]})};A.defaultProps={size:18};const z=A,L={display:"block"},k=e=>{let{size:n,color:r,style:i,...t}=e;const c=i?{...L,...i}:L;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:c,...t,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:o(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:o(r,1,"#333333")})]})};k.defaultProps={size:18};const M=k,P={display:"block"},N=e=>{let{size:n,color:r,style:i,...t}=e;const c=i?{...P,...i}:P;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:c,...t,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:o(r,0,"#333333")})})};N.defaultProps={size:18};const E=N,T={display:"block"},O=e=>{let{size:n,color:r,style:i,...t}=e;const c=i?{...T,...i}:T;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:c,...t,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:o(r,0,"#333333")})})};O.defaultProps={size:18};const B=O,I={display:"block"},q=e=>{let{size:n,color:r,style:i,...t}=e;const c=i?{...I,...i}:I;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:c,...t,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:o(r,0,"#333333")})})};q.defaultProps={size:18};const U=q,G=e=>{let{name:n,...r}=e;switch(n){case"youhua":return(0,s.jsx)(c,{...r});case"dayi":return(0,s.jsx)(x,{...r});case"shengji":return(0,s.jsx)(p,{...r});case"tiaozheng":return(0,s.jsx)(b,{...r});case"gengxin":return(0,s.jsx)(g,{...r});case"wendang":return(0,s.jsx)(y,{...r});case"shanchu":return(0,s.jsx)(S,{...r});case"bug":return(0,s.jsx)(z,{...r});case"xinzeng":return(0,s.jsx)(M,{...r});case"fuwu":return(0,s.jsx)(E,{...r});case"down":return(0,s.jsx)(B,{...r});case"up":return(0,s.jsx)(U,{...r})}return null},H={label:"label_p8vM",icon:"icon_knQK"};function R(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:H.label,title:n,style:{backgroundColor:r[n].bgColor},children:[(0,s.jsx)(G,{name:r[n].icon,color:"white",size:14,className:H.icon})," ",n]})}},1151:(e,n,r)=>{r.d(n,{Z:()=>c,a:()=>t});var o=r(7294);const s={},i=o.createContext(s);function t(e){const n=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:t(e.components),o.createElement(i.Provider,{value:n},e.children)}}}]);