var authorizeData = endpoint?.Metadata.GetOrderedMetadata<IAuthorizeData>() ?? Array.Empty<IAuthorizeData>(); [......] 继续阅读
var authorizeData = endpoint?.Metadata.GetOrderedMetadata<IAuthorizeData>() ?? Array.Empty<IAuthorizeData>(); [......] 继续阅读
C# has common types with the following suffixes, and the author has summarized their general uses. Extensions Helper or Helpers Scheme Builder Context Factory Provider Options Defaults Extensions This type is used to implement extension methods, with the class…
C# 中有常见的以以下名称为后缀的类型,笔者总结了一下大概用途。 Extensions Helper 或 Helpers Scheme Builder Context Factory Provider Options Defaults Extensions 此类型用于实现拓展函数,类名后加上 Extensions。 如下面的示例实现了拓展函数,就是我们平时使用的 app.UseAuthentication();。 public static class AuthAppBuilderExtensions { publ…
Introduction Purpose of Writing Requirements Analysis Overview Design 1. Create a new feature to identify permission control; 2. Permission control is based on Controller and Action; 3. Based on the built-in permission authentication of ASP.NET Core; 4. Requir…
前导 编写目的 需求分析 概要设计 1,创建一个新特性,用来标识权限控制; 2,权限控制以 Controller、Action 作为单位; 3,基于 ASP.NET Core 自带的权限认证; 4,要求极速响应; 5,支持响应事件,对于验证流程,不同阶段触发事件; 6,设置接口,定义方法,如何判断用户是否有权限; 7,可以通过特性或使用默认的 ASP.NET Core 授权特性,只要登陆就有权访问的API 8,支持自定义401,403等授权验证码 详细设计 项目分析 项目介绍与功能分析 项目运行环境 项目应用场景 …
Introduction CZGL.SystemInfo is a resource information retrieval library that supports Windows and Linux, used to obtain system environment, machine resource information, and system resource usage. Search for CZGL.SystemInfo in NuGet to install it. I have adde…
简介 CZGL.SystemInfo 是一个支持 Windows 和 Linux 的资源信息获取库,用于获取系统环境、机器资源信息、系统资源使用情况。 Nuget 搜索 CZGL.SystemInfo 即可安装。 类库中每一个属性和方法,我都加上了注释,调用时可以看得到。 平台通用 CZGL.SystemInfo 命名空间下,有个 EnvironmentInfo 静态类,用于获取各种信息。 CZGL.SystemInfo.Info 命名空间中,有三个类型,用于获取和记录不同类型的信息。 MachineRunInfo…
To improve project code quality, analyzers are often installed. However, these analyzers occupy 10MB when generating project program files. Since these DLLs are unnecessary, they should not be left taking up space. You can use the built-in Property Manager in …
为了提高项目代码质量,所以往往会安装分析器。 但是呢,这些分析器在生成项目程序文件时,占了 10MB。这些 dll 用不上的,没必要留着占空间。 可以使用 VS 自带的属性管理器去除 也可以手动 打开项目 .csproj 文件,找到如下的两个节点 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <CodeAnalysisRuleSet&g…
%# %# is used for formatted output, typically in the form %#p. %x is used to display in hexadecimal format, but the output format may vary depending on the environment. %p displays a hexadecimal representation of a system address as an integer within the range…
The analyzer is named miniprofiler, and the official website is https://miniprofiler.com/dotnet/. It can be directly integrated into the code and run tests after deployment. It supports performance analysis for the following frameworks: ASP.NET ASP.NET Core Co…
分析器名为 miniprofiler,官网地址为 https://miniprofiler.com/dotnet/ 可以直接放到代码中,发布后运行测试。 支持以下框架的性能分析: ASP.NET ASP.NET Core Console .NET Console .NET Core EF6 EF Core SQL [......] 继续阅读
C language does not have a bool type, but many places require true and false. How to solve this? In C language, 1 and 0, or non-zero and 0, are generally used to represent true and false. For example: int a = 6666; int b = 161616; printf("%s", a &…
C语言中没有 bool 类型,但是很多地方都需要 true 和 flase,怎么解决呢? C 语言 一般使用 1 和 0 或 非0 和 0 表示 true 和 flase。 例如 int a = 6666; int b = 161616; printf("%s",a & b?"true":"flase"); a&b 的结果是一个数字,只要大于 0 或 小于 0 ,即为 true。 而且 C# 中,?: 运算符,左侧条件必须是 bool ,不…
Binary numbers, Any number bitwise ANDed with N ones results in itself; or ORed with N zeros results in itself. Any number bitwise ANDed with N zeros results in N zeros; any number bitwise ORed with N ones results in N ones. Bitwise ANDing with N ones. 1 0 1 0…
二进制数, 任何数与 N 个 1 进行按位与,结果等于自身;或者与 N 个 0 进行按位或,结果等于自身。 任何数与 N 个 0 进行按位与,结果是 N 个 0;任何数与 N 个 1 进行按位或,结果是 N 个 1; 与 N 个 1 按位与。 1 0 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 1 1 1 1 可以通过此特性来获取某几位上的数。 获取某几位上的数字 例如获取一个 int 类型 8-11 位的数据。 C#版 int num, mark; …
RuntimeInformation and Environment Fetching Information Reflection to Fetch Information Fetching Property Values Reflection to Fetch Attribute Values Fetching a Property's Value and Alias Reflection to Fetch Information Usage Summary The author’s nine articles…
RuntimeInformation、Environment 获取信息 反射获取信息 获取属性值 反射获取特性值 获取某个属性的值以及别名 反射获取信息 使用 总结 [......] 继续阅读
背景: When debugging tests, it's necessary to use NSwag.AspNetCore to provide swagger services, but it's not needed for formal release deployment. The NSwag.AspNetCore library file reaches 6MB. This can be handled in the project file using the condition Conditio…