text: "use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[6918],{3905:function(e,n,t){t.d(n,{Zo:function(){return d},kt:function(){return m}});var i=t(7294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,i,r=function(e,n){if(null==e)return{};var t,i,r={},a=Object.keys(e);for(i=0;i<a.length;i++)t=a[i],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)t=a[i],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=i.createContext({}),p=function(e){var n=i.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=p(e.components);return i.createElement(c.Provider,{value:n},e.children)},s={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},u=i.forwardRef((function(e,n){var t=e.components,r=e.mdxType,a=e.originalType,c=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(t),m=r,f=u["".concat(c,".").concat(m)]||u[m]||s[m]||a;return t?i.createElement(f,o(o({ref:n},d),{},{components:t})):i.createElement(f,o({ref:n},d))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var a=t.length,o=new Array(a);o[0]=u;var l={};for(var c in n)hasOwnProperty.call(n,c)&&(l[c]=n[c]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var p=2;p<a;p++)o[p]=t[p];return i.createElement.apply(null,o)}return i.createElement.apply(null,t)}u.displayName="MDXCreateElement"},7023:function(e,n,t){t.r(n),t.d(n,{frontMatter:function(){return l},contentTitle:function(){return c},metadata:function(){return p},toc:function(){return d},default:function(){return u}});var i=t(3117),r=t(102),a=(t(7294),t(3905)),o=["components"],l={id:"dependencyinjectionsettings",title:"4. \u4f9d\u8d56\u6ce8\u5165\u914d\u7f6e",sidebar_label:"4. \u4f9d\u8d56\u6ce8\u5165\u914d\u7f6e"},c=void 0,p={unversionedId:"settings/dependencyinjectionsettings",id:"settings/dependencyinjectionsettings",isDocsHomePage:!1,title:"4. \u4f9d\u8d56\u6ce8\u5165\u914d\u7f6e",description:"4.1 \u5173\u4e8e\u914d\u7f6e",source:"@site/docs/settings/dependencyinjectionsettings.mdx",sourceDirName:"settings",slug:"/settings/dependencyinjectionsettings",permalink:"/furion/docs/settings/dependencyinjectionsettings",editUrl:"https://gitee.com/dotnetchina/Furion/tree/master/handbook/docs/settings/dependencyinjectionsettings.mdx",tags:[],version:"current",lastUpdatedBy:"sourcehome",lastUpdatedAt:1614316883,formattedLastUpdatedAt:"2/26/2021",frontMatter:{id:"dependencyinjectionsettings",title:"4. \u4f9d\u8d56\u6ce8\u5165\u914d\u7f6e",sidebar_label:"4. \u4f9d\u8d56\u6ce8\u5165\u914d\u7f6e"},sidebar:"settings",previous:{title:"3. \u9a8c\u8bc1\u6d88\u606f\u914d\u7f6e",permalink:"/furion/docs/settings/validationTypemessagesettings"},next:{title:"5. \u52a8\u6001API\u914d\u7f6e",permalink:"/furion/docs/settings/dynamicapicontrollersettings"}},d=[{value:"4.1 \u5173\u4e8e\u914d\u7f6e",id:"41-\u5173\u4e8e\u914d\u7f6e",children:[],level:2},{value:"4.2 \u914d\u7f6e\u4fe1\u606f",id:"42-\u914d\u7f6e\u4fe1\u606f",children:[],level:2},{value:"4.3 \u914d\u7f6e\u793a\u4f8b",id:"43-\u914d\u7f6e\u793a\u4f8b",children:[],level:2}],s={toc:d};function u(e){var n=e.components,t=(0,r.Z)(e,o);return(0,a.kt)("wrapper",(0,i.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"41-\u5173\u4e8e\u914d\u7f6e"},"4.1 \u5173\u4e8e\u914d\u7f6e"),(0,a.kt)("p",null,"\u4f9d\u8d56\u6ce8\u5165\u914d\u7f6e\u6307\u7684\u662f ",(0,a.kt)("inlineCode",{parentName:"p"},"Furion")," \u6846\u67b6\u4f9d\u8d56\u6ce8\u5165\u914d\u7f6e\u9009\u9879\u3002"),(0,a.kt)("h2",{id:"42-\u914d\u7f6e\u4fe1\u606f"},"4.2 \u914d\u7f6e\u4fe1\u606f"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"DependencyInjectionSettings"),"\uff1a\u4f9d\u8d56\u6ce8\u5165\u914d\u7f6e\u6839\u8282\u70b9",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Definitions"),"\uff1a\u52a8\u6001\u4f9d\u8d56\u6ce8\u5165\u914d\u7f6e\u8282\u70b9\uff0c",(0,a.kt)("inlineCode",{parentName:"li"},"ExternalService")," \u6570\u7ec4\u7c7b\u578b",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"ExternalService"),"\uff1a\u914d\u7f6e\u5355\u4e2a\u4f9d\u8d56\u6ce8\u5165\u4fe1\u606f",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Interface"),"\uff1a\u914d\u7f6e\u4f9d\u8d56\u63a5\u53e3\u4fe1\u606f\uff0c\u683c\u5f0f\uff1a",(0,a.kt)("inlineCode",{parentName:"li"},"\u7a0b\u5e8f\u96c6\u540d\u79f0;\u63a5\u53e3\u5b8c\u6574\u540d\u79f0"),"\uff0c\u5982\uff1a",(0,a.kt)("inlineCode",{parentName:"li"},"Furion.Application;Furion.Application.ITestService")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Service"),"\uff1a\u914d\u7f6e\u63a5\u53e3\u5b9e\u73b0\u4fe1\u606f\uff0c\u683c\u5f0f\u540c\u4e0a"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"RegisterType"),"\uff1a\u914d\u7f6e\u4f9d\u8d56\u6ce8\u5165\u7684\u5bf9\u8c61\u751f\u5b58\u671f\uff0c\u53d6\u503c\uff1a",(0,a.kt)("inlineCode",{parentName:"li"},"Transient"),"\uff0c",(0,a.kt)("inlineCode",{parentName:"li"},"Scoped"),"\uff0c",(0,a.kt)("inlineCode",{parentName:"li"},"Singleton")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Action"),"\uff1a\u6ce8\u518c\u884c\u4e3a\uff0c\u53ef\u9009\u503c\uff1a",(0,a.kt)("inlineCode",{parentName:"li"},"Add"),"\uff0c",(0,a.kt)("inlineCode",{parentName:"li"},"TryAdd"),"\uff0c\u53c2\u89c1 ",(0,a.kt)("a",{parentName:"li",href:"../dependency-injection#128-injection-%E7%89%B9%E6%80%A7%E9%85%8D%E7%BD%AE"},"\u4f9d\u8d56\u6ce8\u5165-\u7279\u6027\u914d\u7f6e")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Pattern"),"\uff1a\u6ce8\u518c\u9009\u9879\uff0c\u53c2\u89c1 ",(0,a.kt)("a",{parentName:"li",href:"../dependency-injection#128-injection-%E7%89%B9%E6%80%A7%E9%85%8D%E7%BD%AE"},"\u4f9d\u8d56\u6ce8\u5165-\u7279\u6027\u914d\u7f6e\u7f6e")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Named"),"\uff1a\u6ce8\u518c\u522b\u540d\uff0c\u53c2\u89c1 ",(0,a.kt)("a",{parentName:"li",href:"../dependency-injection#128-injection-%E7%89%B9%E6%80%A7%E9%85%8D%E7%BD%AE"},"\u4f9d\u8d56\u6ce8\u5165-\u7279\u6027\u914d\u7f6e")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Order"),"\uff1a\u6ce8\u518c\u6392\u5e8f\uff0c\u53c2\u89c1 ",(0,a.kt)("a",{parentName:"li",href:"../dependency-injection#128-injection-%E7%89%B9%E6%80%A7%E9%85%8D%E7%BD%AE"},"\u4f9d\u8d56\u6ce8\u5165-\u7279\u6027\u914d\u7f6e")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Proxy"),"\uff1a\u914d\u7f6e\u4ee3\u7406\u62e6\u622a\uff0c\u683c\u5f0f\uff1a",(0,a.kt)("inlineCode",{parentName:"li"},"\u7a0b\u5e8f\u96c6\u540d\u79f0;\u4ee3\u7406\u7c7b\u5b8c\u6574\u540d\u79f0"),"\uff0c\u53c2\u89c1 ",(0,a.kt)("a",{parentName:"li",href:"../dependency-injection#128-injection-%E7%89%B9%E6%80%A7%E9%85%8D%E7%BD%AE"},"\u4f9d\u8d56\u6ce8\u5165-\u7279\u6027\u914d\u7f6e"))))))))),(0,a.kt)("h2",{id:"43-\u914d\u7f6e\u793a\u4f8b"},"4.3 \u914d\u7f6e\u793a\u4f8b"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-json"},'{\n  "DependencyInjectionSettings": {\n    "Definitions": [\n      {\n        "Interface": "Furion.Application;Furion.Application.ITestService",\n        "Service": "Furion.Application;Furion.Application.TestService",\n        "RegisterType": "Transient",\n        "Action": "Add",\n        "Pattern": "SelfWithFirstInterface",\n        "Named": "TestService",\n        "Order": 1,\n        "Proxy": "Furion.Application;Furion.Application.LogDispathProxy"\n      }\n    ]\n  }\n}\n')))}u.isMDXComponent=!0}}]);