Harbour.NETCore.Serilog
8.0.0
dotnet add package Harbour.NETCore.Serilog --version 8.0.0
NuGet\Install-Package Harbour.NETCore.Serilog -Version 8.0.0
<PackageReference Include="Harbour.NETCore.Serilog" Version="8.0.0" />
<PackageVersion Include="Harbour.NETCore.Serilog" Version="8.0.0" />
<PackageReference Include="Harbour.NETCore.Serilog" />
paket add Harbour.NETCore.Serilog --version 8.0.0
#r "nuget: Harbour.NETCore.Serilog, 8.0.0"
#addin nuget:?package=Harbour.NETCore.Serilog&version=8.0.0
#tool nuget:?package=Harbour.NETCore.Serilog&version=8.0.0
Harbour.NETCoreExtensions
介绍
Harbour.AspNetCore 是将Furion项目最小化拆分,并移除部分特性的AspNetCore6工具集
先注册 .AddNewtonsoftJson()
再注册AddUnifyResult()
2、中间件注册顺序
if (env.IsDevelopment())
app.UseDeveloperExceptionPage();
// 添加规范化结果状态码,需要在这里注册
app.UseUnifyResultStatusCodes();
app.UseStaticFiles();
//启用会话
app.UseSession();
app.UseRouting();
// 跨域
app.UseCorsAccessor();
// vue 路由
app.UseVueRouterHistory();
//启用登陆验证
app.UseAuthentication();
app.UseAuthorization();
// 规范化文档
app.UseSpecificationDocuments();
// FineUI 和 MVC 中间件(确保 UseFineUI 位于 UseMvc 的前面)
app.UseFineUI();
app.UseEndpoints(endpoints =>());
1、UnifyResult:规范化结果
1、使用方式
1、services.AddUnifyResult();
2、实现IValidationMessageTypeProvider可验证消息类型提供器
3、实现IErrorCodeTypeProvider可异常错误代码提供器
2、原理
通过DataValidationFilter过滤器(IActionFilter),拦截验证失败返回结果,实现对响应数据验证的处理 通过IAsyncExceptionFilter过滤器(IAsyncExceptionFilter),拦截抛出异常的返回结果,实现对响应友好异常的处理 通过UnifyResultFilter过滤器(IAsyncActionFilter),实现对响应成功的结果规范化处理
2、UnifyResultStatusCodes:规范化结果状态码
1、使用方式
1、services.AddUnifyResult(); app.UseUnifyResultStatusCodes();
2、原理
通过注册UnifyResultStatusCodesMiddleware中间件,实现对所有Response的拦截并解析StatusCode>=400且StatusCode!=404的响应 并将401、403的状态码改为200,规范化返回内容
更新历史
2024-11-10:同步更新至:2024-11-10 09bf28cefd8cc17168caf18567e15a00b585e253;时间:2024/11/10 13:05:52
2022-10-30:同步更新至:2022-10-30 2b7e0c83e698d37f3c8326d4a177eee4f9ab942c
2022-06-14:同步更新至:2022-06-14 2ebb01c593b21d72dd17a86e6f9860fab9714e01
2022-05-29:同步跟新至:2022-05-25 3b9d39ce691f9505c5541a790103fbb0ba6d35af
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.3)
- Serilog.Extensions.Hosting (>= 9.0.0)
- Serilog.Settings.Configuration (>= 9.0.0)
- Serilog.Sinks.Console (>= 6.0.0)
- Serilog.Sinks.File (>= 6.0.0)
- Serilog.Sinks.Grafana.Loki (>= 8.3.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Harbour.NETCore.Serilog:
Package | Downloads |
---|---|
Sinovel.FineUIWebCore
Sinovel.FineUIWebCore |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.0.0 | 136 | 23 days ago |
6.4.0 | 225 | 5 months ago |
6.3.11 | 533 | 8/31/2023 |
6.3.10 | 250 | 7/14/2023 |
6.3.9 | 183 | 7/14/2023 |
6.3.8 | 250 | 7/8/2023 |
6.3.6 | 151 | 7/8/2023 |
6.3.5 | 175 | 6/30/2023 |
6.3.4 | 158 | 6/25/2023 |
6.3.3 | 145 | 6/20/2023 |
6.3.2 | 162 | 5/16/2023 |
6.3.1 | 157 | 5/3/2023 |
6.2.1 | 471 | 6/18/2022 |
6.2.0 | 418 | 6/18/2022 |
6.1.1 | 429 | 6/15/2022 |
6.1.0 | 411 | 6/15/2022 |
6.0.1 | 418 | 5/27/2022 |
6.0.0 | 424 | 5/27/2022 |