EasilyNET.WebCore 1.8.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package EasilyNET.WebCore --version 1.8.3
NuGet\Install-Package EasilyNET.WebCore -Version 1.8.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EasilyNET.WebCore" Version="1.8.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasilyNET.WebCore --version 1.8.3
#r "nuget: EasilyNET.WebCore, 1.8.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EasilyNET.WebCore as a Cake Addin
#addin nuget:?package=EasilyNET.WebCore&version=1.8.3

// Install EasilyNET.WebCore as a Cake Tool
#tool nuget:?package=EasilyNET.WebCore&version=1.8.3

EasilyNET.WebCore

一些.Net 6+ 的 WebApi 常用中间件和一些 Filter,以及部分数据类型到 Json 的转换

EasilyNET.WebCore Filter 使用?

目前支持异常处理和返回数据格式化

  • 使用 Nuget 安装 EasilyNET.WebCore

  • 然后在 Program.cs 中添加如下内容

  • Net 6 +

// Add services to the container.
builder.Services.AddControllers(c =>
{
    c.Filters.Add<ExceptionFilter>(); // 异常处理Filter
    c.Filters.Add<ActionExecuteFilter>(); // 返回数据格式化Filter
});

EasilyNET.WebCore JsonConverter 使用?

  • 该库目前补充的 Converter 有: DateTimeConverter, DateTimeNullConverter, TimeSpanJsonConverter, TimeOnly, DateOnly

  • 其中 TimeOnly 和 DateOnly 仅支持.Net6+ API 内部使用,传入和传出 Json 仅支持固定格式字符串

  • 如: DateOnly👉"2021-11-11", TimeOnly👉"23:59:25"

  • 使用 Nuget 安装 EasilyNET.WebCore

  • 然后在上述 Program.cs 中添加如下内容

  • .Net 6 +

// Add services to the container.
builder.Services.AddControllers(c =>
{
    c.Filters.Add<ExceptionFilter>(); // 异常处理Filter
    c.Filters.Add<ActionExecuteFilter>(); // 返回数据格式化Filter
}).AddJsonOptions(c =>
{
    c.JsonSerializerOptions.Converters.Add(new SystemTextJsonConvert.DateTimeConverter());
    c.JsonSerializerOptions.Converters.Add(new SystemTextJsonConvert.DateTimeNullConverter());
});

EasilyNET.WebCore 中间件使用?

目前支持全局 API 执行时间中间件

  • 新增限流中间件(防抖),用于避免短时间内,重复请求

  • 使用 Nuget 安装 # EasilyNET.WebCore

  • 然后在 Program.cs 中添加如下内容

  • .Net 6 +

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment()) app.UseDeveloperExceptionPage();

app.UseHoyoResponseTime(); // 全局Action执行时间
...
app.Run();

.Net 6 中使用 3 种库的方法集合

  • Program.cs 文件
var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddControllers(c =>
{
    c.Filters.Add<ExceptionFilter>(); // 异常处理Filter
    c.Filters.Add<ActionExecuteFilter>(); // 返回数据格式化Filter
}).AddJsonOptions(c =>
{
    c.JsonSerializerOptions.Converters.Add(new SystemTextJsonConvert.DateTimeConverter());
    c.JsonSerializerOptions.Converters.Add(new SystemTextJsonConvert.DateTimeNullConverter());
});
...

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment()) app.UseDeveloperExceptionPage();

app.UseHoyoResponseTime();
...
  • API 响应结果示例
{
  "statusCode": 200,
  "msg": "success",
  "data": [
    {
      "date": "2021-10-10 17:38:16",
      "temperatureC": 6,
      "temperatureF": 42,
      "summary": "Freezing"
    },
    {
      "date": "2021-10-11 17:38:16",
      "temperatureC": 18,
      "temperatureF": 64,
      "summary": "Warm"
    }
  ]
}
  • Response headers
hoyo-response-time: 5 ms
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on EasilyNET.WebCore:

Package Downloads
EasilyNET.WebCore.Swagger

一些Swagger的一些配置.如分组,隐藏接口,Authorize的接口添加🔒,默认值

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.24.512.213 80 5/12/2024
3.24.508.112 90 5/8/2024
2.2024.428.71 90 4/28/2024
2.2024.427.1128 85 4/27/2024
2.2.72 94 4/14/2024
2.2.71 78 4/12/2024
2.2.8 79 4/26/2024
2.2.6 87 4/10/2024
2.2.5 101 3/26/2024
2.2.4 84 3/25/2024
2.2.3 92 3/24/2024
2.2.2 102 3/21/2024
2.2.1 104 3/20/2024
2.2.0 102 3/13/2024
2.1.9 110 2/21/2024
2.1.8 86 2/18/2024
2.1.7 80 2/16/2024
2.1.6 106 2/14/2024
2.1.5 77 2/14/2024
2.1.4 129 2/9/2024
2.1.3 125 2/8/2024
2.1.2 124 2/5/2024
2.1.1.2 198 12/26/2023
2.1.1.1 113 12/26/2023
2.1.1 134 12/25/2023
2.1.0 146 12/17/2023
2.0.11 180 12/6/2023
2.0.1 181 11/15/2023
2.0.0 119 11/14/2023
1.9.1 124 11/1/2023
1.9.0 120 10/19/2023
1.9.0-preview2 240 10/12/2023
1.9.0-preview1 95 10/12/2023
1.8.9 167 10/11/2023
1.8.8 148 10/11/2023
1.8.7-rc2 109 9/21/2023
1.8.7-rc1 94 9/12/2023
1.8.6 152 8/31/2023
1.8.5 222 8/25/2023
1.8.4 150 8/24/2023
1.8.3 150 8/23/2023
1.8.2 220 8/22/2023
1.8.1 170 8/18/2023
1.8.0 176 8/15/2023
1.7.9 199 8/11/2023
1.7.8 147 8/11/2023
1.7.7 176 8/10/2023
1.7.6 183 8/9/2023
1.7.5 218 8/9/2023
1.7.4 260 8/3/2023
1.7.3 173 8/1/2023
1.7.2 156 7/31/2023
1.7.1 146 7/27/2023
1.7.0 166 7/25/2023
1.6.9 170 7/25/2023
1.6.8 168 7/24/2023
1.6.7 184 7/20/2023
1.6.6 178 7/19/2023
1.6.5 153 7/19/2023
1.6.4 166 7/17/2023
1.6.3 137 7/17/2023
1.6.2 215 7/12/2023
1.6.1 223 6/30/2023
1.6.0 145 6/26/2023
1.5.9 172 6/22/2023
1.5.8 193 6/15/2023
1.5.7.1 178 6/14/2023
1.5.7 182 6/14/2023
1.5.6.2 214 6/7/2023
1.5.6.1 170 6/7/2023
1.5.6 163 6/7/2023
1.5.5.2 210 5/26/2023
1.5.5.1 182 5/26/2023
1.5.5 187 5/26/2023
1.5.4.4 171 5/25/2023
1.5.4.3 201 5/23/2023
1.5.4.2 270 5/17/2023
1.5.4.1 171 5/16/2023
1.5.4 258 5/11/2023
1.5.3 172 5/11/2023
1.5.2 196 5/10/2023
1.5.1 192 5/10/2023
1.5.0 236 5/6/2023
1.4.0 204 5/5/2023
1.3.9 242 4/23/2023
1.3.8.6 170 4/23/2023
1.3.8.5 175 4/21/2023
1.3.8.1 233 4/12/2023
1.3.8 178 4/11/2023
1.3.7 214 4/9/2023
1.3.6.3 285 4/1/2023
1.3.6.2 200 3/31/2023
1.3.6.1 201 3/31/2023
1.3.6 173 3/31/2023
1.3.5 189 3/30/2023
1.3.4.1 254 3/29/2023
1.3.4 204 3/28/2023
1.3.3 176 3/28/2023
1.3.2 210 3/26/2023
1.3.1 270 3/22/2023
1.3.0 211 3/21/2023
1.2.0 202 3/21/2023
1.1.0 220 3/17/2023
1.0.9 225 3/15/2023
1.0.8 224 3/15/2023
1.0.7 201 3/15/2023
1.0.6 224 3/13/2023
1.0.5 219 3/13/2023
1.0.4 202 3/13/2023
1.0.1 309 2/23/2023
1.0.0 223 2/20/2023