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
13 KiB
JavaScript
1 line
13 KiB
JavaScript
"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[9763],{7734:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>t,contentTitle:()=>r,default:()=>a,frontMatter:()=>i,metadata:()=>c,toc:()=>o});var l=s(5893),d=s(1151);const i={id:"module-dev",title:"28. \u6a21\u5757\u5316\u5f00\u53d1",sidebar_label:"28. \u6a21\u5757\u5316\u5f00\u53d1"},r=void 0,c={id:"module-dev",title:"28. \u6a21\u5757\u5316\u5f00\u53d1",description:"\u4ee5\u4e0b\u7684\u6a21\u5757\u5316\u914d\u7f6e\u5fc5\u987b\u5728 appsettings.json \u4e0b\u914d\u7f6e\u624d\u6709\u6548\uff0c\u539f\u56e0\u662f\u542f\u52a8\u7684\u65f6\u5019 appsettings.json \u5df2\u7ecf\u52a0\u8f7d\uff0c\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u8fd8\u672a\u52a0\u8f7d\u3002",source:"@site/docs/module-dev.mdx",sourceDirName:".",slug:"/module-dev",permalink:"/docs/module-dev",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/module-dev.mdx",tags:[],version:"current",lastUpdatedBy:"\u767e\u5c0f\u50e7",lastUpdatedAt:1696901835,formattedLastUpdatedAt:"Oct 10, 2023",frontMatter:{id:"module-dev",title:"28. \u6a21\u5757\u5316\u5f00\u53d1",sidebar_label:"28. \u6a21\u5757\u5316\u5f00\u53d1"},sidebar:"docs",previous:{title:"27. \u5206\u5e03\u5f0f ID \u751f\u6210",permalink:"/docs/idgenerator"},next:{title:"29. \u7c98\u571f\u5bf9\u8c61",permalink:"/docs/clayobj"}},t={},o=[{value:"28.1 \u5173\u4e8e\u6a21\u5757\u5316\u5f00\u53d1",id:"281-\u5173\u4e8e\u6a21\u5757\u5316\u5f00\u53d1",level:2},{value:"28.1.1 \u6a21\u5757\u5316\u5f00\u53d1\u597d\u5904",id:"2811-\u6a21\u5757\u5316\u5f00\u53d1\u597d\u5904",level:3},{value:"28.2 \u6a21\u5757\u5206\u7c7b",id:"282-\u6a21\u5757\u5206\u7c7b",level:2},{value:"28.3 \u5982\u4f55\u8fdb\u884c\u6a21\u5757\u5316\u5f00\u53d1",id:"283-\u5982\u4f55\u8fdb\u884c\u6a21\u5757\u5316\u5f00\u53d1",level:2},{value:"28.3.1 \u542f\u7528\u6a21\u5757\u5316\u652f\u6301",id:"2831-\u542f\u7528\u6a21\u5757\u5316\u652f\u6301",level:3},{value:"28.3.2 \u5404\u79cd\u6dfb\u52a0\u6a21\u5757\u914d\u7f6e\u65b9\u5f0f",id:"2832-\u5404\u79cd\u6dfb\u52a0\u6a21\u5757\u914d\u7f6e\u65b9\u5f0f",level:3},{value:"28.4 \u6a21\u5757\u5316\u5f00\u53d1\u6ce8\u610f\u4e8b\u9879",id:"284-\u6a21\u5757\u5316\u5f00\u53d1\u6ce8\u610f\u4e8b\u9879",level:2},{value:"28.5 \u5173\u4e8e\u70ed\u63d2\u62d4\u673a\u5236",id:"285-\u5173\u4e8e\u70ed\u63d2\u62d4\u673a\u5236",level:2},{value:"28.6 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"286-\u53cd\u9988\u4e0e\u5efa\u8bae",level:2}];function h(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,d.a)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"important",children:(0,l.jsxs)(n.p,{children:["\u4ee5\u4e0b\u7684\u6a21\u5757\u5316\u914d\u7f6e\u5fc5\u987b\u5728 ",(0,l.jsx)(n.code,{children:"appsettings.json"})," \u4e0b\u914d\u7f6e\u624d\u6709\u6548\uff0c\u539f\u56e0\u662f\u542f\u52a8\u7684\u65f6\u5019 ",(0,l.jsx)(n.code,{children:"appsettings.json"})," \u5df2\u7ecf\u52a0\u8f7d\uff0c\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u8fd8\u672a\u52a0\u8f7d\u3002"]})}),"\n",(0,l.jsx)(n.h2,{id:"281-\u5173\u4e8e\u6a21\u5757\u5316\u5f00\u53d1",children:"28.1 \u5173\u4e8e\u6a21\u5757\u5316\u5f00\u53d1"}),"\n",(0,l.jsx)(n.p,{children:"\u6a21\u5757\u5316\u662f\u4ee3\u7801\u7684\u7ec4\u6210\u7684\u4e00\u79cd\u65b9\u5f0f\uff0c\u6a21\u5757\u5316\u7cfb\u7edf\u5c31\u50cf\u4e50\u9ad8\u73a9\u5177\u4e00\u6837\uff0c\u4e00\u5757\u4e00\u5757\u96f6\u6563\u79ef\u6728\u5806\u79ef\u8d77\u4e00\u4e2a\u7cbe\u5f69\u7684\u4e16\u754c\u3002\u6bcf\u79cd\u79ef\u6728\u7684\u5f62\u72b6\u5404\u4e0d\u76f8\u540c\uff0c\u529f\u80fd\u5404\u4e0d\u76f8\u540c\uff0c\u79ef\u6728\u4e0e\u79ef\u6728\u76f4\u63a5\u4e92\u76f8\u4f9d\u8d56\uff0c\u4e92\u76f8\u652f\u6491\u3002"}),"\n",(0,l.jsx)(n.h3,{id:"2811-\u6a21\u5757\u5316\u5f00\u53d1\u597d\u5904",children:"28.1.1 \u6a21\u5757\u5316\u5f00\u53d1\u597d\u5904"}),"\n",(0,l.jsx)(n.p,{children:"\u6a21\u5757\u5316\u5f00\u53d1\u80fd\u591f\u5c06\u4e0d\u540c\u7684\u529f\u80fd\u7ec4\u88c5\u5728\u4e00\u8d77\uff0c\u5b9e\u73b0\u529f\u80fd\u7684\u7d2f\u52a0\uff0c\u8bf8\u591a\u529f\u80fd\u7ec4\u88c5\u5728\u4e00\u8d77\uff0c\u6700\u7ec8\u5f62\u6210\u9879\u76ee\u3002"}),"\n",(0,l.jsx)(n.h2,{id:"282-\u6a21\u5757\u5206\u7c7b",children:"28.2 \u6a21\u5757\u5206\u7c7b"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"\u5e94\u7528\u7a0b\u5e8f\u6a21\u5757"}),"\uff1a\u901a\u5e38\u8fd9\u7c7b\u6a21\u5757\u662f\u5b8c\u6574\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u72ec\u7acb\u8fd0\u884c\uff0c\u6709\u81ea\u5df1\u7684\u5b9e\u4f53\u3001\u670d\u52a1\u3001API \u53ca UI \u7ec4\u4ef6\u7b49\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"\u6846\u67b6\u7ea7\u6a21\u5757"}),"\uff1a\u8fd9\u7c7b\u901a\u5e38\u662f\u89e3\u51b3\u67d0\u4e2a\u4e1a\u52a1\u529f\u80fd\u8fdb\u884c\u5f00\u53d1\u7684\u6a21\u5757\uff0c\u6bd4\u5982\u4e0a\u4f20\u6587\u4ef6\u3001\u5206\u5e03\u5f0f\u7f13\u5b58\u3001\u6570\u636e\u9a8c\u8bc1\u7b49\u3002"]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"283-\u5982\u4f55\u8fdb\u884c\u6a21\u5757\u5316\u5f00\u53d1",children:"28.3 \u5982\u4f55\u8fdb\u884c\u6a21\u5757\u5316\u5f00\u53d1"}),"\n",(0,l.jsxs)(n.p,{children:["\u5728 ",(0,l.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u8bbe\u8ba1\u4e4b\u521d\u5c31\u8003\u8651\u5230\u6a21\u5757\u5316\u5f00\u53d1\uff0c\u6240\u4ee5\u4ece\u6700\u521d\u7248\u672c\u5c31\u5177\u5907\u6b64\u529f\u80fd\u3002\u542f\u7528 ",(0,l.jsx)(n.code,{children:"Furion"})," \u6a21\u5757\u5316\u652f\u6301\u975e\u5e38\u7b80\u5355\u3002"]}),"\n",(0,l.jsx)(n.h3,{id:"2831-\u542f\u7528\u6a21\u5757\u5316\u652f\u6301",children:"28.3.1 \u542f\u7528\u6a21\u5757\u5316\u652f\u6301"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-json",metastring:"showLineNumbers {2,3,4}",children:'{\r\n "AppSettings": {\r\n "EnabledReferenceAssemblyScan": true, // \u542f\u7528\u6a21\u5757\u5316\u7a0b\u5e8f\u96c6\u626b\u63cf\r\n "SupportPackageNamePrefixs": ["Module1", "Module2",...] // \u914d\u7f6e\u901a\u8fc7 NuGet \u65b9\u5f0f\u5b89\u88c5\u7684\u6a21\u5757\u5316\u5305\uff0c\u5982\u679c\u4e0d\u662f\u901a\u8fc7 NuGet \u65b9\u5f0f\u53ef\u4e0d\u914d\u7f6e\r\n // "ExternalAssemblies": ["plugins/Module1.dll", "plugins/Module2.dll", ...] // \u914d\u7f6e\u52a0\u8f7d\u7f51\u7ad9 plugins \u76ee\u5f55\u4e0b\u7684\u6a21\u5757\u7a0b\u5e8f\u96c6\uff0c\u53ef\u4e0d\u914d\u7f6e\r\n }\r\n}\n'})}),"\n",(0,l.jsx)(n.h3,{id:"2832-\u5404\u79cd\u6dfb\u52a0\u6a21\u5757\u914d\u7f6e\u65b9\u5f0f",children:"28.3.2 \u5404\u79cd\u6dfb\u52a0\u6a21\u5757\u914d\u7f6e\u65b9\u5f0f"}),"\n",(0,l.jsx)(n.p,{children:"\u6dfb\u52a0\u6a21\u5757\u5230\u73b0\u6709\u7684\u5e94\u7528\u4e2d\u6709\u591a\u79cd\u65b9\u5f0f\uff1a"}),"\n",(0,l.jsxs)(n.ol,{children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsxs)(n.strong,{children:["\u76f4\u63a5\u901a\u8fc7\u9879\u76ee\u6dfb\u52a0\u6a21\u5757\u5316\u5f15\u7528\u6216\u7f16\u8f91 ",(0,l.jsx)(n.code,{children:".csproj"})," \u6dfb\u52a0\u6a21\u5757"]})}),"\n"]}),"\n",(0,l.jsxs)(n.p,{children:["\u8fd9\u79cd\u65b9\u5f0f\u65e0\u9700\u4efb\u4f55\u914d\u7f6e\uff0c",(0,l.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u53ef\u81ea\u52a8\u52a0\u8f7d\u6a21\u5757\u3002"]}),"\n",(0,l.jsxs)(n.ol,{start:"2",children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsxs)(n.strong,{children:["\u901a\u8fc7\u6dfb\u52a0 ",(0,l.jsx)(n.code,{children:".dll"})," \u65b9\u5f0f\u5f15\u7528\u6a21\u5757"]})}),"\n"]}),"\n",(0,l.jsxs)(n.p,{children:["\u9700\u8981\u914d\u7f6e ",(0,l.jsx)(n.code,{children:"EnabledReferenceAssemblyScan"})," \u8282\u70b9\uff0c\u5982\uff1a"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-json",metastring:"showLineNumbers {3}",children:'{\r\n "AppSettings": {\r\n "EnabledReferenceAssemblyScan": true\r\n }\r\n}\n'})}),"\n",(0,l.jsxs)(n.ol,{start:"3",children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsxs)(n.strong,{children:["\u901a\u8fc7 ",(0,l.jsx)(n.code,{children:"NuGet"})," \u65b9\u5f0f\u5b89\u88c5\u6a21\u5757"]})}),"\n"]}),"\n",(0,l.jsxs)(n.p,{children:["\u5982\u679c\u901a\u8fc7 ",(0,l.jsx)(n.code,{children:"NuGet"})," \u65b9\u5f0f\u5b89\u88c5\u6a21\u5757\uff0c\u9700\u8981\u914d\u7f6e ",(0,l.jsx)(n.code,{children:"SupportPackageNamePrefixs"})," \u8282\u70b9\uff0c\u5982\uff1a"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-json",metastring:"showLineNumbers {3}",children:'{\r\n "AppSettings": {\r\n "SupportPackageNamePrefixs": ["NuGet\u5305\u540d\u79f0", "NuGet\u5305\u540d\u79f0",...]\r\n }\r\n}\n'})}),"\n",(0,l.jsxs)(n.ol,{start:"4",children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsxs)(n.strong,{children:["\u901a\u8fc7\u52a8\u6001\u52a0\u8f7d ",(0,l.jsx)(n.code,{children:".dll"})," \u65b9\u5f0f\u5b89\u88c5\u6a21\u5757"]})}),"\n"]}),"\n",(0,l.jsxs)(n.p,{children:["\u8fd9\u79cd\u65b9\u5f0f\u901a\u5e38\u662f\u5728\u7f51\u7ad9\u521b\u5efa\u4e00\u4e2a\u6587\u4ef6\u5939\u653e\u5165\u6a21\u5757\u5316 ",(0,l.jsx)(n.code,{children:".dll"})," \u6587\u4ef6\uff0c\u5982\uff1a",(0,l.jsx)(n.code,{children:"plugins"}),"\uff0c\u65e0\u9700\u6dfb\u52a0\u5f15\u7528\u53ef\u81ea\u52a8\u52a0\u8f7d\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-json",metastring:"showLineNumbers {3}",children:'{\r\n "AppSettings": {\r\n "ExternalAssemblies": ["plugins/Module1.dll", "plugins/Module2.dll", ...]\r\n }\r\n}\n'})}),"\n",(0,l.jsxs)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"important",children:[(0,l.jsxs)(n.p,{children:["\u5982\u679c\u975e\u751f\u4ea7\u73af\u5883\uff0c\u90a3\u4e48 ",(0,l.jsx)(n.code,{children:"plugins"})," \u6587\u4ef6\u5939\u653e\u5728 ",(0,l.jsx)(n.code,{children:"bin\\Debug\\net n.0\\"})," \u6216 ",(0,l.jsx)(n.code,{children:"bin\\Release\\net n.0"})," \u76ee\u5f55\u4e0b\u3002"]}),(0,l.jsx)(n.p,{children:"\u5982\u679c\u662f\u751f\u4ea7\u73af\u5883\uff0c\u5219\u76f4\u63a5\u653e\u5728\u6839\u76ee\u5f55\u5373\u53ef\u3002"})]}),"\n",(0,l.jsx)(n.h2,{id:"284-\u6a21\u5757\u5316\u5f00\u53d1\u6ce8\u610f\u4e8b\u9879",children:"28.4 \u6a21\u5757\u5316\u5f00\u53d1\u6ce8\u610f\u4e8b\u9879"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["\u5c3d\u53ef\u80fd\u4fdd\u8bc1\u6bcf\u4e2a\u6a21\u5757\u90fd\u6709\u72ec\u7acb\u7684\u8def\u7531\u5730\u5740\u683c\u5f0f\uff1a",(0,l.jsx)(n.code,{children:"/\u6a21\u5757\u5316\u540d\u79f0/\u8def\u7531\u5730\u5740"}),"\uff0c\u8fd9\u6837\u624d\u80fd\u4fdd\u8bc1\u4e0d\u4f1a\u548c\u73b0\u6709\u7684\u7cfb\u7edf\u51fa\u73b0\u51b2\u7a81\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:["\u5f00\u53d1\u6a21\u5757\u5316\u662f\u5c3d\u53ef\u80fd\u8bbe\u8ba1\u4e3a\u5b8c\u5168\u72ec\u7acb\u7684\u5f15\u7528\uff0c",(0,l.jsx)(n.strong,{children:"\u5982\u679c\u9700\u8981\u5305\u542b UI \u5143\u7d20\u5982\u89c6\u56fe\u3001html/cs/javascript \u5e94\u91c7\u7528\u5d4c\u5165\u5f0f\u65b9\u5f0f"}),"\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:["\u6a21\u5757\u5316\u5f00\u53d1\u5982\u679c\u9700\u8981\u6dfb\u52a0\u7b2c\u4e09\u65b9\u670d\u52a1\uff0c\u5e94\u914d\u7f6e\u5728 ",(0,l.jsx)(n.code,{children:"AppStartup"})," \u7684\u6d3e\u751f\u7c7b\u4e2d\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:["\u6a21\u5757\u5316\u7684\u6240\u5728\u7a0b\u5e8f\u96c6\u7684\u6ce8\u91ca\u6587\u4ef6 ",(0,l.jsx)(n.code,{children:".xml"})," \u9700\u653e\u5728\u548c ",(0,l.jsx)(n.code,{children:".dll"})," \u540c\u7ea7\u76ee\u5f55"]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"285-\u5173\u4e8e\u70ed\u63d2\u62d4\u673a\u5236",children:"28.5 \u5173\u4e8e\u70ed\u63d2\u62d4\u673a\u5236"}),"\n",(0,l.jsxs)(n.p,{children:["\u5728 ",(0,l.jsx)(n.code,{children:"Furion v2.4.0 +"})," \u7248\u672c\u4e4b\u540e\uff0c",(0,l.jsx)(n.strong,{children:"\u6846\u67b6\u79fb\u9664\u4e86\u70ed\u52a0\u8f7d\u548c\u70ed\u5378\u8f7d\u6a21\u5757\u7684\u529f\u80fd"}),"\uff0c\u539f\u56e0\u662f\u76ee\u524d\u5fae\u8f6f\u63d0\u4f9b\u7684 ",(0,l.jsx)(n.code,{children:"AssemblyLoadContext + \u6587\u4ef6\u5939\u76d1\u542c"})," \u5904\u7406 ",(0,l.jsx)(n.code,{children:".dll"})," \u8fd0\u884c\u65f6\u70ed\u62d4\u63d2\u673a\u5236\u8fd8\u672a\u6210\u719f\uff0c\u6b64\u529f\u80fd\u5c06\u5728 ",(0,l.jsx)(n.code,{children:".NET8"})," \u7248\u672c\u5f97\u5230\u6539\u5584\u3002"]}),"\n",(0,l.jsxs)(n.p,{children:["\u4e5f\u5c31\u662f\uff0c\u81ea ",(0,l.jsx)(n.code,{children:"v2.4.0+"})," \u7248\u672c\u4e4b\u540e\uff0c",(0,l.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u53ea\u63d0\u4f9b\u5728\u542f\u52a8\u65f6\u52a0\u8f7d\u6a21\u5757\uff0c\u4e0d\u5728\u8fd0\u884c\u65f6\u8fdb\u884c\u4efb\u4f55\u5904\u7406\u3002"]}),"\n",(0,l.jsx)(n.h2,{id:"286-\u53cd\u9988\u4e0e\u5efa\u8bae",children:"28.6 \u53cd\u9988\u4e0e\u5efa\u8bae"}),"\n",(0,l.jsx)(n.admonition,{title:"\u4e0e\u6211\u4eec\u4ea4\u6d41",type:"note",children:(0,l.jsxs)(n.p,{children:["\u7ed9 Furion \u63d0 ",(0,l.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/new?issue",children:"Issue"}),"\u3002"]})})]})}function a(e={}){const{wrapper:n}={...(0,d.a)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(h,{...e})}):h(e)}},1151:(e,n,s)=>{s.d(n,{Z:()=>c,a:()=>r});var l=s(7294);const d={},i=l.createContext(d);function r(e){const n=l.useContext(i);return l.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(d):e.components||d:r(e.components),l.createElement(i.Provider,{value:n},e.children)}}}]); |