YY-Tech.YYApi
0.1.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package YY-Tech.YYApi --version 0.1.0
NuGet\Install-Package YY-Tech.YYApi -Version 0.1.0
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="YY-Tech.YYApi" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YY-Tech.YYApi --version 0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: YY-Tech.YYApi, 0.1.0"
#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 YY-Tech.YYApi as a Cake Addin
#addin nuget:?package=YY-Tech.YYApi&version=0.1.0
// Install YY-Tech.YYApi as a Cake Tool
#tool nuget:?package=YY-Tech.YYApi&version=0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
YYApi 基于Asp.net Core 3的一个基础辅助包
包含了以下组件:
- 统一的参数检测,基础认证服务 所有的控制器需要继承 YYApi.Controllers.BaseController
using Models;
namespace Controllers
{
public class BaseController : YYApi.Controllers.BaseController
{
/// <summary>
/// 获取登录用户信息
/// </summary>
protected User LoginInfo => (User) HttpContext.Items["LoginInfo"];
}
}
- 基于Swagger的API文档服务
#Startup.cs
services.AddApiDoc("文档名称", "文档描述");
app.UseApiDoc("名称",SubmitMethod[])
#控制器中可以直接使用特性
[ApiDoc("分组","名称")]
- 简单的基于Redis的登录TOKEN服务
#Startup.cs
service.AddAuth();
添加时候, 可以从DI中获取 Auth 类,调用 Auth.SetId(int) 将用户ID和生成的Token绑定,本方法返回缓存中的Key名称
#Startup.cs
app.UseAuthMiddleware();
调用本中间件,然后再需要登录认证的地方,使用 [CheckAuth] 特性,即可完成检测登录相关的操作, 如果需要获取用户的ID, 只需要 直接使用 LoginId 属性即可获取
统一返回 所有Response 均需要继承 BaseResponse类
异常处理 本异常中间件封装了API错误的异常处理,控制器可以使用 Error(int,string) 直接返回API错误
#Startup.cs
app.UseExceptionMiddleware();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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. |
.NET Core | netcoreapp3.1 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- Swashbuckle.AspNetCore.Annotations (>= 5.0.0-rc4)
- Swashbuckle.AspNetCore.SwaggerUI (>= 5.0.0-rc4)
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 |
---|---|---|
0.4.5 | 503 | 7/4/2020 |
0.4.2 | 515 | 6/27/2020 |
0.3.6 | 493 | 3/12/2020 |
0.3.5 | 458 | 3/11/2020 |
0.3.4 | 472 | 3/4/2020 |
0.3.3 | 437 | 3/3/2020 |
0.3.2 | 515 | 2/18/2020 |
0.3.1 | 508 | 2/17/2020 |
0.3.0 | 521 | 2/17/2020 |
0.2.10 | 453 | 2/5/2020 |
0.2.9 | 476 | 2/4/2020 |
0.2.8 | 430 | 2/4/2020 |
0.2.7 | 449 | 2/2/2020 |
0.2.3 | 462 | 2/2/2020 |
0.2.2 | 472 | 1/17/2020 |
0.2.1 | 427 | 1/17/2020 |
0.2.0 | 438 | 1/16/2020 |
0.1.7 | 461 | 1/8/2020 |
0.1.6 | 450 | 1/6/2020 |
0.1.5 | 473 | 1/6/2020 |
0.1.3 | 445 | 12/27/2019 |
0.1.2 | 468 | 12/24/2019 |
0.1.0 | 452 | 12/23/2019 |
0.0.2 | 453 | 12/23/2019 |
0.0.1 | 487 | 12/18/2019 |