EasilyNET.WebCore
1.9.1
See the version list below for details.
dotnet add package EasilyNET.WebCore --version 1.9.1
NuGet\Install-Package EasilyNET.WebCore -Version 1.9.1
<PackageReference Include="EasilyNET.WebCore" Version="1.9.1" />
paket add EasilyNET.WebCore --version 1.9.1
#r "nuget: EasilyNET.WebCore, 1.9.1"
// Install EasilyNET.WebCore as a Cake Addin #addin nuget:?package=EasilyNET.WebCore&version=1.9.1 // Install EasilyNET.WebCore as a Cake Tool #tool nuget:?package=EasilyNET.WebCore&version=1.9.1
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
EasilyNET.WebCore 当前用户 使用?
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddCurrentUser();
var app = builder.Build();
var currentUser=app.Services.GetService<ICurrentUser>();
currentUser.GetUserId<long>();
或者
currentUser.GetUserId<long>("sub");
Product | Versions 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. |
-
net6.0
- EasilyNET.Core (>= 1.9.1)
-
net7.0
- EasilyNET.Core (>= 1.9.1)
-
net8.0
- EasilyNET.Core (>= 1.9.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.24.1113.100 | 34 | 11/13/2024 |
3.24.1112.125 | 44 | 11/12/2024 |
3.24.1107.140 | 46 | 11/7/2024 |
3.24.1107.54 | 44 | 11/7/2024 |
3.24.1107.34 | 37 | 11/7/2024 |
3.24.1105.111 | 72 | 11/5/2024 |
3.24.1103.31 | 75 | 11/2/2024 |
3.24.1103 | 88 | 11/2/2024 |
3.24.1031.135 | 81 | 10/31/2024 |
3.24.1031.112 | 75 | 10/31/2024 |
3.24.1031.104 | 76 | 10/31/2024 |
3.24.1029.142 | 84 | 10/29/2024 |
3.24.1025.30 | 82 | 10/24/2024 |
3.24.1022.142 | 67 | 10/22/2024 |
3.24.1018.204 | 132 | 10/18/2024 |
3.24.1018.175 | 129 | 10/18/2024 |
3.24.1018.166 | 120 | 10/18/2024 |
3.24.1018.93 | 139 | 10/18/2024 |
3.24.1017.42 | 87 | 10/16/2024 |
3.24.1016.161 | 84 | 10/16/2024 |
3.24.1015.231 | 80 | 10/15/2024 |
3.24.1015.14 | 89 | 10/14/2024 |
3.24.1012.114 | 85 | 10/12/2024 |
3.24.1009.115 | 85 | 10/9/2024 |
3.24.1008.160 | 79 | 10/8/2024 |
3.24.1008.133 | 80 | 10/8/2024 |
3.24.1007.185 | 85 | 10/7/2024 |
3.24.1003.33 | 94 | 10/2/2024 |
3.24.1002.162 | 83 | 10/2/2024 |
3.24.929.143 | 86 | 9/29/2024 |
3.24.929.141 | 96 | 9/29/2024 |
3.24.929.131 | 79 | 9/29/2024 |
3.24.929.122 | 87 | 9/29/2024 |
3.24.926.184 | 98 | 9/26/2024 |
3.24.926.182 | 86 | 9/26/2024 |
3.24.926.175 | 97 | 9/26/2024 |
3.24.924.160 | 84 | 9/24/2024 |
3.24.924.133 | 101 | 9/24/2024 |
3.24.924.124 | 88 | 9/24/2024 |
3.24.924.10 | 87 | 9/23/2024 |
3.24.924.1 | 89 | 9/23/2024 |
3.24.923.234 | 90 | 9/23/2024 |
3.24.923.232 | 84 | 9/23/2024 |
3.24.923.155 | 86 | 9/23/2024 |
3.24.919.92 | 98 | 9/19/2024 |
3.24.914.125 | 86 | 9/14/2024 |
3.24.914.115 | 96 | 9/14/2024 |
3.24.914.111 | 97 | 9/14/2024 |
3.24.911.95 | 119 | 9/11/2024 |
3.24.908.215 | 103 | 9/8/2024 |
3.24.904.200 | 105 | 9/4/2024 |
3.24.828.163 | 105 | 8/28/2024 |
3.24.820.173 | 104 | 8/20/2024 |
3.24.814.92 | 116 | 8/14/2024 |
3.24.812.115 | 127 | 8/12/2024 |
3.24.802.100 | 93 | 8/2/2024 |
3.24.801.162 | 91 | 8/1/2024 |
3.24.801.160 | 92 | 8/1/2024 |
3.24.730.164 | 75 | 7/30/2024 |
3.24.730.91 | 77 | 7/30/2024 |
3.24.724.91 | 85 | 7/24/2024 |
3.24.718.105 | 108 | 7/18/2024 |
3.24.716.95 | 95 | 7/16/2024 |
3.24.712.94 | 96 | 7/12/2024 |
3.24.710.14 | 108 | 7/9/2024 |
3.24.709.105 | 131 | 7/9/2024 |
3.24.704.94 | 110 | 7/4/2024 |
3.24.701.90 | 107 | 7/1/2024 |
3.24.628.114 | 136 | 6/28/2024 |
3.24.627.145 | 99 | 6/27/2024 |
3.24.620.160 | 117 | 6/20/2024 |
3.24.613.115 | 106 | 6/13/2024 |
3.24.612.95 | 103 | 6/12/2024 |
3.24.528.90 | 103 | 5/28/2024 |
3.24.522.84 | 114 | 5/22/2024 |
3.24.512.213 | 102 | 5/12/2024 |
3.24.508.112 | 123 | 5/8/2024 |
2.2024.428.71 | 114 | 4/28/2024 |
2.2024.427.1128 | 101 | 4/27/2024 |
2.2.72 | 114 | 4/14/2024 |
2.2.71 | 104 | 4/12/2024 |
2.2.8 | 116 | 4/26/2024 |
2.2.6 | 114 | 4/10/2024 |
2.2.5 | 139 | 3/26/2024 |
2.2.4 | 122 | 3/25/2024 |
2.2.3 | 117 | 3/24/2024 |
2.2.2 | 145 | 3/21/2024 |
2.2.1 | 140 | 3/20/2024 |
2.2.0 | 130 | 3/13/2024 |
2.1.9 | 147 | 2/21/2024 |
2.1.8 | 124 | 2/18/2024 |
2.1.7 | 117 | 2/16/2024 |
2.1.6 | 129 | 2/14/2024 |
2.1.5 | 109 | 2/14/2024 |
2.1.4 | 174 | 2/9/2024 |
2.1.3 | 159 | 2/8/2024 |
2.1.2 | 153 | 2/5/2024 |
2.1.1.2 | 232 | 12/26/2023 |
2.1.1.1 | 136 | 12/26/2023 |
2.1.1 | 170 | 12/25/2023 |
2.1.0 | 172 | 12/17/2023 |
2.0.11 | 230 | 12/6/2023 |
2.0.1 | 217 | 11/15/2023 |
2.0.0 | 154 | 11/14/2023 |
1.9.1 | 162 | 11/1/2023 |
1.9.0 | 157 | 10/19/2023 |
1.9.0-preview2 | 324 | 10/12/2023 |
1.9.0-preview1 | 134 | 10/12/2023 |
1.8.9 | 219 | 10/11/2023 |
1.8.8 | 169 | 10/11/2023 |
1.8.7-rc2 | 136 | 9/21/2023 |
1.8.7-rc1 | 133 | 9/12/2023 |
1.8.6 | 200 | 8/31/2023 |
1.8.5 | 827 | 8/25/2023 |
1.8.4 | 196 | 8/24/2023 |
1.8.3 | 190 | 8/23/2023 |
1.8.2 | 256 | 8/22/2023 |
1.8.1 | 218 | 8/18/2023 |
1.8.0 | 217 | 8/15/2023 |
1.7.9 | 232 | 8/11/2023 |
1.7.8 | 165 | 8/11/2023 |
1.7.7 | 207 | 8/10/2023 |
1.7.6 | 212 | 8/9/2023 |
1.7.5 | 246 | 8/9/2023 |
1.7.4 | 299 | 8/3/2023 |
1.7.3 | 205 | 8/1/2023 |
1.7.2 | 183 | 7/31/2023 |
1.7.1 | 184 | 7/27/2023 |
1.7.0 | 196 | 7/25/2023 |
1.6.9 | 208 | 7/25/2023 |
1.6.8 | 201 | 7/24/2023 |
1.6.7 | 218 | 7/20/2023 |
1.6.6 | 203 | 7/19/2023 |
1.6.5 | 193 | 7/19/2023 |
1.6.4 | 202 | 7/17/2023 |
1.6.3 | 164 | 7/17/2023 |
1.6.2 | 260 | 7/12/2023 |
1.6.1 | 258 | 6/30/2023 |
1.6.0 | 173 | 6/26/2023 |
1.5.9 | 200 | 6/22/2023 |
1.5.8 | 224 | 6/15/2023 |
1.5.7.1 | 206 | 6/14/2023 |
1.5.7 | 210 | 6/14/2023 |
1.5.6.2 | 249 | 6/7/2023 |
1.5.6.1 | 210 | 6/7/2023 |
1.5.6 | 196 | 6/7/2023 |
1.5.5.2 | 239 | 5/26/2023 |
1.5.5.1 | 223 | 5/26/2023 |
1.5.5 | 219 | 5/26/2023 |
1.5.4.4 | 197 | 5/25/2023 |
1.5.4.3 | 228 | 5/23/2023 |
1.5.4.2 | 308 | 5/17/2023 |
1.5.4.1 | 204 | 5/16/2023 |
1.5.4 | 294 | 5/11/2023 |
1.5.3 | 199 | 5/11/2023 |
1.5.2 | 223 | 5/10/2023 |
1.5.1 | 222 | 5/10/2023 |
1.5.0 | 271 | 5/6/2023 |
1.4.0 | 235 | 5/5/2023 |
1.3.9 | 282 | 4/23/2023 |
1.3.8.6 | 193 | 4/23/2023 |
1.3.8.5 | 194 | 4/21/2023 |
1.3.8.1 | 269 | 4/12/2023 |
1.3.8 | 199 | 4/11/2023 |
1.3.7 | 225 | 4/9/2023 |
1.3.6.3 | 303 | 4/1/2023 |
1.3.6.2 | 228 | 3/31/2023 |
1.3.6.1 | 232 | 3/31/2023 |
1.3.6 | 181 | 3/31/2023 |
1.3.5 | 199 | 3/30/2023 |
1.3.4.1 | 274 | 3/29/2023 |
1.3.4 | 222 | 3/28/2023 |
1.3.3 | 200 | 3/28/2023 |
1.3.2 | 229 | 3/26/2023 |
1.3.1 | 297 | 3/22/2023 |
1.3.0 | 235 | 3/21/2023 |
1.2.0 | 223 | 3/21/2023 |
1.1.0 | 242 | 3/17/2023 |
1.0.9 | 252 | 3/15/2023 |
1.0.8 | 248 | 3/15/2023 |
1.0.7 | 225 | 3/15/2023 |
1.0.6 | 240 | 3/13/2023 |
1.0.5 | 248 | 3/13/2023 |
1.0.4 | 223 | 3/13/2023 |
1.0.1 | 331 | 2/23/2023 |
1.0.0 | 248 | 2/20/2023 |