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
11 KiB
JavaScript

1 year ago
"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[7057],{5875:(n,e,s)=>{s.r(e),s.d(e,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>l,metadata:()=>d,toc:()=>t});var i=s(5893),o=s(1151),r=s(4996);const l={id:"globalusing",title:"2.12 GlobalUsing \u4f7f\u7528",sidebar_label:"2.12 GlobalUsing \u4f7f\u7528",description:"\u5b66\u4e60\u5982\u4f55\u907f\u514d\u4ee3\u7801\u5934\u90e8\u5927\u91cf Using"},c=void 0,d={id:"globalusing",title:"2.12 GlobalUsing \u4f7f\u7528",description:"\u5b66\u4e60\u5982\u4f55\u907f\u514d\u4ee3\u7801\u5934\u90e8\u5927\u91cf Using",source:"@site/docs/globalusing.mdx",sourceDirName:".",slug:"/globalusing",permalink:"/docs/globalusing",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/globalusing.mdx",tags:[],version:"current",lastUpdatedBy:"\u767e\u5c0f\u50e7",lastUpdatedAt:1700811349,formattedLastUpdatedAt:"Nov 24, 2023",frontMatter:{id:"globalusing",title:"2.12 GlobalUsing \u4f7f\u7528",sidebar_label:"2.12 GlobalUsing \u4f7f\u7528",description:"\u5b66\u4e60\u5982\u4f55\u907f\u514d\u4ee3\u7801\u5934\u90e8\u5927\u91cf Using"},sidebar:"docs",previous:{title:"2.11 .NET7 \u5347\u7ea7 .NET8 \u2728",permalink:"/docs/net7-to-net8"},next:{title:"2.13 JSON Schema \u4f7f\u7528",permalink:"/docs/jsonschema"}},a={},t=[{value:"2.12.1 \u5173\u4e8e <code>GlobalUsing</code>",id:"2121-\u5173\u4e8e-globalusing",level:2},{value:"2.12.2 \u5fc5\u8981\u914d\u7f6e",id:"2122-\u5fc5\u8981\u914d\u7f6e",level:2},{value:"2.12.3 \u57fa\u672c\u4f7f\u7528",id:"2123-\u57fa\u672c\u4f7f\u7528",level:2},{value:"2.12.3.1 \u9ed8\u8ba4\u5168\u5c40 <code>using</code>",id:"21231-\u9ed8\u8ba4\u5168\u5c40-using",level:3},{value:"2.12.4 <code>.NET5</code> \u9879\u76ee\u5f00\u542f\u652f\u6301",id:"2124-net5-\u9879\u76ee\u5f00\u542f\u652f\u6301",level:2},{value:"2.12.5 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"2125-\u53cd\u9988\u4e0e\u5efa\u8bae",level:2}];function g(n){const e={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",...(0,o.a)(),...n.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(e.h2,{id:"2121-\u5173\u4e8e-globalusing",children:["2.12.1 \u5173\u4e8e ",(0,i.jsx)(e.code,{children:"GlobalUsing"})]}),"\n",(0,i.jsxs)(e.p,{children:["\u5728 ",(0,i.jsx)(e.code,{children:".NET6/C#10"})," \u4e4b\u540e\uff0c\u5fae\u8f6f\u65b0\u589e\u4e86 ",(0,i.jsx)(e.code,{children:"GlobalUsings"})," \u673a\u5236\uff0c\u53ef\u4ee5\u5728\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a ",(0,i.jsx)(e.code,{children:"GlobalUsings.cs"})," \u6587\u4ef6\uff0c\u628a\u5e38\u7528\u7684 ",(0,i.jsx)(e.code,{children:"using"})," \u653e\u7f6e\u5176\u4e2d\u3002"]}),"\n",(0,i.jsxs)(e.p,{children:["\u8fd9\u6837 ",(0,i.jsx)(e.code,{children:"GlobalUsings.cs"})," \u6240\u5728\u7684\u9879\u76ee ",(0,i.jsx)(e.code,{children:".cs"})," \u6587\u4ef6\u5c31\u65e0\u9700\u91cd\u590d ",(0,i.jsx)(e.code,{children:"using"})," \u4e86\uff0c\u5927\u5927\u7684\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\uff0c\u4e5f\u8ba9\u4ee3\u7801\u53d8\u7684\u66f4\u52a0\u7b80\u6d01\u3002"]}),"\n",(0,i.jsx)(e.h2,{id:"2122-\u5fc5\u8981\u914d\u7f6e",children:"2.12.2 \u5fc5\u8981\u914d\u7f6e"}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsxs)(e.strong,{children:["\u542f\u7528 ",(0,i.jsx)(e.code,{children:"GlobalUsings"})," \u673a\u5236\u9700\u8981\u4ee5\u4e0b\u4e24\u4e2a\u6b65\u9aa4\uff1a"]})}),"\n",(0,i.jsxs)(e.ol,{children:["\n",(0,i.jsxs)(e.li,{children:["\u5728\u4f60\u9700\u8981\u5168\u5c40 ",(0,i.jsx)(e.code,{children:"using"})," \u7684\u9879\u76ee\u5c42\u6839\u76ee\u5f55\u521b\u5efa ",(0,i.jsx)(e.code,{children:"GlobalUsings.cs"})," \u6587\u4ef6\uff0c\u5982\u679c\u591a\u4e2a\u9879\u76ee\u5c42\u9700\u8981\uff0c\u5219\u6bcf\u4e2a\u5c42\u90fd\u5e94\u8be5\u6709\u4e00\u4e2a ",(0,i.jsx)(e.code,{children:"GlobalUsings.cs"})]}),"\n",(0,i.jsxs)(e.li,{children:["\u7f16\u8f91\u9879\u76ee\u7684 ",(0,i.jsx)(e.code,{children:".csproj"})," \u6587\u4ef6\uff0c\u6dfb\u52a0 ",(0,i.jsx)(e.code,{children:"<ImplicitUsings>enable</ImplicitUsings>"}),"\uff0c\u6ce8\u610f\u662f\u5728 "