SkyData.AspNetCore.AutoCurd.SqlSugar
1.0.7
dotnet add package SkyData.AspNetCore.AutoCurd.SqlSugar --version 1.0.7
NuGet\Install-Package SkyData.AspNetCore.AutoCurd.SqlSugar -Version 1.0.7
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="SkyData.AspNetCore.AutoCurd.SqlSugar" Version="1.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SkyData.AspNetCore.AutoCurd.SqlSugar --version 1.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SkyData.AspNetCore.AutoCurd.SqlSugar, 1.0.7"
#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 SkyData.AspNetCore.AutoCurd.SqlSugar as a Cake Addin #addin nuget:?package=SkyData.AspNetCore.AutoCurd.SqlSugar&version=1.0.7 // Install SkyData.AspNetCore.AutoCurd.SqlSugar as a Cake Tool #tool nuget:?package=SkyData.AspNetCore.AutoCurd.SqlSugar&version=1.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SkyData.AspNetCore.AutoCurd.SqlSugar
介绍
SkyData.AspNetCore.AutoCurd.SqlSugar 是SqlSugar版的一些预置控制器类的集合,主要是为了解决重复写简单CURD 接口的问题。
预置控制器类
控制器名称 | 说明 |
---|---|
AuthCURDController | 带[Authorize]特性的DefaultCURDController控制器 |
DefaultCURDController | 默认带有常用增删查改,分页控制器.(如果有界面模型类或传输模型需要实现对象映射器接口ICURDMapper) |
DefaultAddController | 默认带有常用增加相关控制器. |
DefaultSelectController | 默认带有常用查找相关控制器. |
DefaultUpdateController | 默认带有常用更新相关控制器 |
DefaultDeleteController | 默认带有常用删除相关控制器. |
以上控制器均带有分页查询的Api。
使用演示
//前提:需要注入SqlSugarScope对象
services.AddSingleton<SqlSugarScope>(_=>DbContext.Scope);
//只有数据模型的情况
public class UnitInfoController: DefaultCURDController<FhTUnitInfo, int>
{
public UnitInfoController(IServiceProvider serviceProvider)
: base(new DefaultCURDService<FhTUnitInfo>(serviceProvider))
{
}
}
//前提:ICURDMapper 为对象映射器接口,CURDMapper为ICURDMapper的实现类
services.AddScoped<ICURDMapper, CURDMapper>();
//有界面模型的情况,这时候需完成相应的映射
public class UnitInfoController: DefaultCURDController<FhTUnitInfo,UnitInfoVM, int>
{
public UnitInfoController(IServiceProvider serviceProvider)
: base(new DefaultCURDService<FhTUnitInfo,UnitInfoVM>(serviceProvider))
{
}
}
//有界面模型和传输模型的情况,这时候需完成相应的映射
public class UnitInfoController: DefaultCURDController<FhTUnitInfo,UnitInfoVM,UnitInfoDto, int>
{
public UnitInfoController(IServiceProvider serviceProvider)
: base(new DefaultCURDService<FhTUnitInfo,UnitInfoVM,UnitInfoDto>(serviceProvider))
{
}
}
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
- Microsoft.AspNetCore.Mvc.Core (>= 2.2.5)
- SkyData.AspNetCore.AutoCurd.Base (>= 1.0.3)
- SqlSugarCore (>= 5.0.4.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.