CloudYxt.Api 3.0.1

.NET 6.0
Install-Package CloudYxt.Api -Version 3.0.1
dotnet add package CloudYxt.Api --version 3.0.1
<PackageReference Include="CloudYxt.Api" Version="3.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CloudYxt.Api --version 3.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CloudYxt.Api, 3.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install CloudYxt.Api as a Cake Addin
#addin nuget:?package=CloudYxt.Api&version=3.0.1

// Install CloudYxt.Api as a Cake Tool
#tool nuget:?package=CloudYxt.Api&version=3.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

云享通.Net Core针对WEBAPI常规操作库。

Product Versions
.NET net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

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.0.1 43 7/25/2022
3.0.0 70 7/14/2022
2.4.8 219 1/21/2022
2.4.7 172 1/20/2022
2.4.6 209 1/20/2022
2.4.5 152 12/24/2021
2.4.4 187 12/1/2021
2.4.3 159 11/29/2021
2.4.2 239 11/12/2021
2.4.1 218 11/12/2021
2.4.0 233 11/12/2021
2.3.3 278 10/25/2021
2.3.2 281 10/20/2021
2.3.1 277 9/10/2021
2.3.0 280 9/10/2021
2.2.1 263 9/10/2021
2.2.0 221 9/9/2021
2.1.0 154 9/7/2021
2.0.0 166 9/3/2021
1.0.1 155 9/2/2021
1.0.0 159 9/2/2021

云享通.Net Core针对WEBAPI常规操作库。

3.0.1
增加ApiMessageInfoException错误包装输出方法

3.0.0
升级包目标为.net6,增加remoteRealIp的ipv6支持

2.4.8
增加HttpContext.outputHtml、HttpContext.outputByte的ContentType类型设置

2.4.7
修复await的可返回BUG

2.4.6
增加HttpContext.outputHtml、HttpContext.outputByte用于WebApi直接输出HTML、字节数组到客户端

2.4.5
增加ApiMessagePackage支持Task控制器输出数据流的异常抛出和数据过滤包装,升级nuget版本

2.4.4
增加ApiMessageLog_Ch的入库字段名称序列

2.4.3
增加ApiMessageLog的ClickHouse类型ApiMessageLog_Ch

2.4.2
修复ApiMessagePackageIgnore属性未生效的BUG及日志记录BUG

2.4.0
同步支持CloudYxt.Base

2.3.3
修复当控制器带有动态类参数时日志未完整记录内容的BUG

2.3.2
修复BUG

2.3.1
通过ApiMessageAuthorizationAttribute认证的userId增加返回认证的Scheme

2.3.0
增加InvalidModelStateResponseFactory的ApiMessage处理方法:
services.Configure<ApiBehaviorOptions>(options =>
           {
               options.InvalidModelStateResponseFactory = ApiHelperExtend.ApiMessageInvalidModelState;
           });

注意:若要获取未验证通过的提交内容,务必EnableBuffering:
app.Use(async (ctx, next) =>
           {
               ctx.Request.EnableBuffering();
               await next();
           });

2.2.1
为ApiMessageLogAttribute增加自定义回调方法CallBackMethodName支持

2.2.0
增加权限认证属性[ApiMessageAuthorization]
权限认证成功后自动编写context.HttpContext.Items["userId"]
默认认证回调检查方法为用户自定义实现protected object mApiAuthorization(string Policy, string Roles, string AuthenticationSchemes, ActionExecutingContext context, string Scheme, string Parameter)
在WEBAPI中可通过User.Identities.FirstOrDefault(m => m.AuthenticationType == "Scheme")?.BootstrapContext获取权限检查成功的用户信息

2.1.0
增加无需日志的属性[ApiMessageLogIgnore]
调整回调日志方法mApiLog可为静态方法
context.HttpContext.Items存储的可选扩展字段名为userId、appId、custom

2.0.0
更名ApiMessage属性为ApiMessagePackage
增加ApiMessageLog,其中通用扩展属性字段可使用context.HttpContext.Items["字段名"]传递
例:(注意属性的绑定顺序)
[ApiController]
[ApiMessageLog(ApiName = "myApi")]
[ApiMessagePackage]
public class extController : ControllerBase
   {
       public void mApiLog(ApiMessageLog log)
       {
//由用户实现log的存储
       }

1.0.1
修复一个类型判断时的BUG

1.0.0:
建立基本处理模型。

[ApiMessage] :数据结果进行messageData包装
[ApiMessageException]:拦截API内报错输出为messageData模式

ApiValidationError:模型验证错误类型
services.Configure<ApiBehaviorOptions>(options =>
{
   options.InvalidModelStateResponseFactory = (context) =>
   {
       var result = context.ModelState.ToMessageResult();
       return result;
   };
});

HttpContext扩展:
remoteRealIp:来源IP
remoteFrom:来源URL
remoteAgent:来源AGENT