You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
21 KiB
JavaScript
1 line
21 KiB
JavaScript
1 year ago
|
"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[988],{1898:(e,s,c)=>{c.r(s),c.d(s,{assets:()=>a,contentTitle:()=>o,default:()=>p,frontMatter:()=>t,metadata:()=>i,toc:()=>d});var n=c(5893),l=c(1151),r=c(510);const t={id:"scoped",title:"11. Scoped \u9759\u6001\u7c7b",sidebar_label:"11. Scoped \u9759\u6001\u7c7b"},o=void 0,i={id:"global/scoped",title:"11. Scoped \u9759\u6001\u7c7b",description:"\ud83d\udcdd \u6a21\u5757\u66f4\u65b0\u65e5\u5fd7",source:"@site/docs/global/scoped.mdx",sourceDirName:"global",slug:"/global/scoped",permalink:"/docs/global/scoped",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/global/scoped.mdx",tags:[],version:"current",lastUpdatedBy:"\u767e\u5c0f\u50e7",lastUpdatedAt:1699259946,formattedLastUpdatedAt:"Nov 6, 2023",frontMatter:{id:"scoped",title:"11. Scoped \u9759\u6001\u7c7b",sidebar_label:"11. Scoped \u9759\u6001\u7c7b"},sidebar:"global",previous:{title:"10. JSON \u9759\u6001\u7c7b",permalink:"/docs/global/json"},next:{title:"12. SpareTime \u9759\u6001\u7c7b",permalink:"/docs/global/sparetime"}},a={},d=[{value:"11.1 \u521b\u5efa\u4e00\u4e2a\u4f9d\u8d56\u6ce8\u5165\u4f5c\u7528\u57df\u8303\u56f4",id:"111-\u521b\u5efa\u4e00\u4e2a\u4f9d\u8d56\u6ce8\u5165\u4f5c\u7528\u57df\u8303\u56f4",level:2},{value:"11.2 \u521b\u5efa\u4e00\u4e2a\u5e26\u5de5\u4f5c\u5355\u5143\u7684\u4f5c\u7528\u57df",id:"112-\u521b\u5efa\u4e00\u4e2a\u5e26\u5de5\u4f5c\u5355\u5143\u7684\u4f5c\u7528\u57df",level:2},{value:"11.3 \u521b\u5efa\u4e00\u4e2a\u4f9d\u8d56\u6ce8\u5165\u4f5c\u7528\u57df\u8303\u56f4\uff08\u5e26\u8fd4\u56de\u503c\uff09",id:"113-\u521b\u5efa\u4e00\u4e2a\u4f9d\u8d56\u6ce8\u5165\u4f5c\u7528\u57df\u8303\u56f4\u5e26\u8fd4\u56de\u503c",level:2},{value:"11.4 \u521b\u5efa\u4e00\u4e2a\u5e26\u5de5\u4f5c\u5355\u5143\u7684\u4f5c\u7528\u57df\uff08\u5e26\u8fd4\u56de\u503c\uff09",id:"114-\u521b\u5efa\u4e00\u4e2a\u5e26\u5de5\u4f5c\u5355\u5143\u7684\u4f5c\u7528\u57df\u5e26\u8fd4\u56de\u503c",level:2}];function h(e){const s={a:"a",admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,l.a)(),...e.components},{Details:c}=s;return c||function(e,s){throw new Error("Expected "+(s?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Details",!0),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(c,{children:[(0,n.jsx)("summary",{children:"\ud83d\udcdd \u6a21\u5757\u66f4\u65b0\u65e5\u5fd7"}),(0,n.jsx)("div",{children:(0,n.jsx)("div",{children:(0,n.jsxs)(s.ul,{children:["\n",(0,n.jsxs)(s.li,{children:["\n",(0,n.jsx)(s.p,{children:(0,n.jsx)(s.strong,{children:"\u95ee\u9898\u4fee\u590d"})}),"\n",(0,n.jsxs)(s.ul,{children:["\n",(0,n.jsxs)(s.li,{children:["\xa0",(0,n.jsx)(r.Z,{children:"\u4fee\u590d"})," ",(0,n.jsx)(s.code,{children:"Scoped.CreateUowAsync"})," \u4f5c\u7528\u57df\u5de5\u4f5c\u5355\u5143\u5f02\u5e38\u65e0\u6cd5\u56de\u6eda\u95ee\u9898 ",(0,n.jsx)("sup",{children:"4.8.8.44"})," ",(0,n.jsx)("sup",{children:"\u23f1\ufe0f2023.09.23"})," ",(0,n.jsx)(s.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I833I9",children:"#I833I9"})]}),"\n"]}),"\n"]}),"\n"]})})})]}),"\n",(0,n.jsx)(s.h2,{id:"111-\u521b\u5efa\u4e00\u4e2a\u4f9d\u8d56\u6ce8\u5165\u4f5c\u7528\u57df\u8303\u56f4",children:"11.1 \u521b\u5efa\u4e00\u4e2a\u4f9d\u8d56\u6ce8\u5165\u4f5c\u7528\u57df\u8303\u56f4"}),"\n",(0,n.jsx)(s.pre,{children:(0,n.jsx)(s.code,{className:"language-cs",metastring:"showLineNumbers",children:"// \u540c\u6b65\r\nScoped.Create((factory, scope) => {\r\n var services = scope.ServiceProvider;\r\n});\r\n\r\n// \u5f02\u6b65\r\nawait Scoped.CreateAsync(async (factory, scope) => {\r\n var services = scope.ServiceProvider;\r\n await _calcService.GetAsync();\r\n // ...\r\n})\n"})}),"\n",(0,n.jsx)(s.admonition,{title:"\u6570\u636e\u5e93\u64cd\u4f5c\u6ce8\u610f",type:"important",children:(0,n.jsxs)(s.p,{children:["\u5982\u679c\u4f5c\u7528\u57df\u4e2d\u5bf9",(0,n.jsx)(s.strong,{children:"\u6570\u636e\u5e93\u6709\u4efb\u4f55\u53d8\u66f4\u64cd\u4f5c"}),"\uff0c\u9700\u624b\u52a8\u8c03\u7528 ",(0,n
|