CloudYxt.SqlSugar
1.0.1
dotnet add package CloudYxt.SqlSugar --version 1.0.1
NuGet\Install-Package CloudYxt.SqlSugar -Version 1.0.1
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="CloudYxt.SqlSugar" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CloudYxt.SqlSugar" Version="1.0.1" />
<PackageReference Include="CloudYxt.SqlSugar" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CloudYxt.SqlSugar --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CloudYxt.SqlSugar, 1.0.1"
#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.
#:package CloudYxt.SqlSugar@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CloudYxt.SqlSugar&version=1.0.1
#tool nuget:?package=CloudYxt.SqlSugar&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CloudYxt .Net Core针对SqlSugar的扩展库
SESSION和LOCKER的初始化挂载
// 初始化挂载,在BackgroundService的Worker中执行
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
_db.MInit(stoppingToken,_logger);
await Task.Delay(Timeout.Infinite, stoppingToken);
}
SESSION使用
// 设置SESSION
await _db.SessionSetAsync(名称, 值, 有效的TimeSpan);
// 获取SESSION
var tag = await _db.SessionGetAsync<类型>(名称);
// 删除SESSION
await _db.SessionDeleteAsync<类型>(名称);
// 手动删除过期SESSION
await _db.SessionClearNotValidAsync<类型>(名称);
// 删除全部SESSION
await _db.SessionClearAllAsync<类型>(名称);
LOCKER使用
// 尝试次数检测
if (await _db.LoginLockRetryMaxAsync(名称, 最大尝试次数))
throw new Exception("尝试次数太多");
// 清理尝试次数
await _db.LoginLockClear(时间);
// 解锁用户尝试次数
await _db.LoginLockUnlock(名称);
ISugarQueryable<T> 扩展
// WhereJsonArraySubset
// 筛选JSON数组字段,查询包含的数组对象(常用于权限范围内筛选)
query.WhereJsonArraySubset(nameof(筛选字段), 可用的数据数组);
// ToDatatableResponseAsync<T>
// 将IdatatableRequest分页请求查询并输出为datatableResponse
// request?.sort?.field == "random" 时为随机排序
query.ToDatatableResponseAsync(request, new string[] { "{ID:-1}", "{ID:1}", "{ADDTIME:-1}", "{ADDTIME:1}" });
| 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- CloudYxt.Base (>= 1.0.3)
- CloudYxt.Common (>= 3.2.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- SqlSugarCore (>= 5.1.4.216)
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 |
|---|---|---|
| 1.0.1 | 114 | 7/10/2026 |
1.0.1
完成基础扩展功能