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
32 KiB
JavaScript
1 line
32 KiB
JavaScript
1 year ago
|
"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[1477],{10:e=>{e.exports=JSON.parse('{"blogPosts":[{"id":"global-usings","metadata":{"permalink":"/blog/global-usings","editUrl":"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/blog/2022-05-31-global-usings.mdx","source":"@site/blog/2022-05-31-global-usings.mdx","title":"7. GlobalUsings \u7684\u4f7f\u7528","description":"\u7b80\u4ecb","date":"2022-05-31T00:00:00.000Z","formattedDate":"May 31, 2022","tags":[{"label":"furion","permalink":"/blog/tags/furion"},{"label":"furos","permalink":"/blog/tags/furos"},{"label":".net","permalink":"/blog/tags/net"},{"label":".netcore","permalink":"/blog/tags/netcore"},{"label":".net5","permalink":"/blog/tags/net-5"},{"label":".net6","permalink":"/blog/tags/net-6"}],"readingTime":2.715,"hasTruncateMarker":false,"authors":[{"name":"dotNET China","title":"\u8ba9 .NET \u5f00\u53d1\u66f4\u7b80\u5355\uff0c\u66f4\u901a\u7528\uff0c\u66f4\u6d41\u884c\u3002","url":"https://gitee.com/dotnetchina","imageURL":"https://i.loli.net/2021/01/19/M8q5a3OTZWUKicl.png"}],"frontMatter":{"slug":"global-usings","title":"7. GlobalUsings \u7684\u4f7f\u7528","author":"dotNET China","author_title":"\u8ba9 .NET \u5f00\u53d1\u66f4\u7b80\u5355\uff0c\u66f4\u901a\u7528\uff0c\u66f4\u6d41\u884c\u3002","author_url":"https://gitee.com/dotnetchina","author_image_url":"https://i.loli.net/2021/01/19/M8q5a3OTZWUKicl.png","tags":["furion","furos",".net",".netcore",".net5",".net6"]},"unlisted":false,"nextItem":{"title":"6. .NET 6 Preview 7 \u5c1d\u9c9c","permalink":"/blog/net6-preview7"}},"content":"import useBaseUrl from \\"@docusaurus/useBaseUrl\\";\\r\\n\\r\\n### \u7b80\u4ecb\\r\\n\\r\\n\u5728 `.NET6/C#10` \u4e4b\u540e\uff0c\u5fae\u8f6f\u65b0\u589e\u4e86 `GlobalUsings` \u673a\u5236\uff0c\u53ef\u4ee5\u5728\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a `GlobalUsings.cs` \u6587\u4ef6\uff0c\u628a\u5e38\u7528\u7684 `using` \u653e\u7f6e\u5176\u4e2d\u3002\\r\\n\\r\\n\u8fd9\u6837 `GlobalUsings.cs` \u6240\u5728\u7684\u9879\u76ee `.cs` \u6587\u4ef6\u5c31\u65e0\u9700\u91cd\u590d `using` \u4e86\uff0c\u5927\u5927\u7684\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\uff0c\u4e5f\u8ba9\u4ee3\u7801\u53d8\u7684\u66f4\u52a0\u7b80\u6d01\u3002\\r\\n\\r\\n### \u5fc5\u8981\u914d\u7f6e\\r\\n\\r\\n**\u542f\u7528 `GlobalUsings` \u673a\u5236\u9700\u8981\u4ee5\u4e0b\u4e24\u4e2a\u6b65\u9aa4\uff1a**\\r\\n\\r\\n1. \u5728\u4f60\u9700\u8981\u5168\u5c40 `using` \u7684\u9879\u76ee\u5c42\u6839\u76ee\u5f55\u521b\u5efa `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 `GlobalUsings.cs`\\r\\n2. \u7f16\u8f91\u9879\u76ee\u7684 `.csproj` \u6587\u4ef6\uff0c\u6dfb\u52a0 `<ImplicitUsings>enable</ImplicitUsings>`\uff0c\u6ce8\u610f\u662f\u5728 `<PropertyGroup>` \u4e2d\u6dfb\u52a0\uff0c\u901a\u5e38\u548c `<TargetFramework>` \u540c\u7236\u540c\u7ea7\\r\\n\\r\\n### \u57fa\u672c\u4f7f\u7528\\r\\n\\r\\n\u914d\u7f6e\u4e4b\u540e\uff0c\u73b0\u5728\u5c31\u53ef\u4ee5\u628a\u5e38\u7528\u7684 `using` \u653e\u5230 `GlobalUsings.cs` \u4e2d\u4e86\uff0c\u5199\u6cd5\u5982\u4e0b\uff1a\\r\\n\\r\\n```cs showLineNumbers title=\\"Furion \u63a8\u8350\u7684\u5168\u5c40\u547d\u540d\u7a7a\u95f4\\"\\r\\nglobal using Furion;\\r\\nglobal using Furion.DatabaseAccessor;\\r\\nglobal using Furion.DataEncryption;\\r\\nglobal using Furion.DataValidation;\\r\\nglobal using Furion.DependencyInjection;\\r\\nglobal using Furion.DynamicApiController;\\r\\nglobal using Furion.Extensions;\\r\\nglobal using Furion.FriendlyException;\\r\\nglobal using Mapster;\\r\\nglobal using Microsoft.AspNetCore.Authorization;\\r\\nglobal using Microsoft.AspNetCore.Http;\\r\\nglobal using Microsoft.AspNetCore.Mvc;\\r\\nglobal using Microsoft.CodeAnalysis;\\r\\nglobal using Microsoft.EntityFrameworkCore;\\r\\nglobal using System.ComponentModel.DataAnnotations;\\r\\n```\\r\\n\\r\\n**\u6ce8\u610f\u5fc5\u987b\u4ee5 `global` \u5f00\u5934\uff01**\\r\\n\\r\\n:::tip \u5c0f\u77e5\u8bc6\\r\\n\\r\\n\u4e00\u822c\u63a8\u8350\u628a\u5b9e\u4f53\u7c7b\
|