RuoVea.ExSugar
7.0.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 RuoVea.ExSugar --version 7.0.0
NuGet\Install-Package RuoVea.ExSugar -Version 7.0.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="RuoVea.ExSugar" Version="7.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RuoVea.ExSugar --version 7.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RuoVea.ExSugar, 7.0.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 RuoVea.ExSugar as a Cake Addin #addin nuget:?package=RuoVea.ExSugar&version=7.0.0 // Install RuoVea.ExSugar as a Cake Tool #tool nuget:?package=RuoVea.ExSugar&version=7.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
RuoVea.ExSqlSugar
ExSqlSugar SqlSugar扩展类库,支持简体中文、繁体中文、粤语、日语、法语、英语.
使用方式
方式一、
1.定义类 DefultDbContext继承 DbContext
/// <summary>
/// DefultDbContext
/// </summary>
public class DefultDbContext : DbContext
{
/// <summary>
/// DefultDbContext
/// </summary>
/// <param name="config"></param>
public DefultDbContext(ConnectionConfig config) : base(config)
{
}
}
2.注入使用DbContext:builder.Services.AddDbContextSetup(x=>{});
builder.Services
.AddDbContextSetup(provide=>new DefultDbContext(AppSettings.GetSection("DefultDbConnString").Get<ConnectionConfig>()))
3.使用的地方注入这个DefultDbContext
public class DemoService : IDemoService
{
private readonly DefultDbContext _defultDbContext;
/// <summary>
///
/// </summary>
/// <param name="defultDbContext"></param>
public DemoService(DefultDbContext defultDbContext)
{
_defultDbContext = defultDbContext;
}
}
方式二、
注册服务 builder.Services.AddSqlSugarSetup(...);// 注册服务
builder.Services.AddSqlSugarSetup();// 注册服务
使用的地方使用
public class DemoService: IDemoService
{
SugarRepository<SysUser> _sysUserRepository;
public DemoService(SugarRepository<SysUser> sysUserRepository) {
_sysUserRepository = sysUserRepository;
}
}
两种方式默认开启了标记删除过滤
按照程序集方式注入应用服务 builder.Services.AddInjectServiceSetup(assembly,)
添加sql执行相关日志
builder.Services.AddRestFulLogSetup<TFilterType>();
创建时
字段属性包涵
CreateTime 默认赋值系统当前时间
Creator 赋值当前登录用户(若有)
创建时
字段属性包涵
ModifyTime 默认赋值系统当前时间
Modifier 赋值当前登录用户(若有)
查询时
字段模型继承了
1、IDeletedEntity 将自动过滤 IsDeleted数据
2、EntityBase、ICreatorFilter 将自动过滤 UserId数据
内置过滤器
配置实体假删除过滤器
IDeletedEntity
创建用户赋值
EntityBase、ICreatorFilter
租户数据过滤
ITenantIdFilter
自定义实体过滤器接口
ICustormerEntityFilter
内置事务单元
使用方式、
1、开启事务单元 services.AddSqlSugarSetup(IsAllUnitOfWork:true);// 注册服务 开启全局事务单元
2、在需要开启的控制器方法增加事务单元特性 [UnitOfWork]
配置文件
/* 数据库链接 具体配置见SqlSugar官网(第一个为默认库不需要设置ConfigId)*/
"ConnectionConfigs": [
{
"DbType": "Sqlite", // MySql、SqlServer、Sqlite、Oracle、PostgreSQL、Dm、Kdbndp、Oscar、MySqlConnector、Access、OpenGauss、QuestDB、HG、ClickHouse、GBase、Odbc、Custom
"ConnectionString": "DataSource=./ruovea.dll", // 库连接字符串
"EnableInitDb": true, // 启用库表初始化
"EnableInitSeed": true, // 启用种子初始化
"EnableDiffLog": true, // 启用库表差异日志
"EnableUnderLine": true, // 启用驼峰转下划线
"IsEncrypt": true, //是否加密
"DbSecurity": "" //链接字符串解密密钥
}
// 其他数据库配置(可以配置多个)
//{
// "ConfigId": "test",
// "DbType": "Sqlite",
// "ConnectionString": "DataSource=./test.db", // 库连接字符串
// "EnableInitDb": true, // 启用库表初始化
// "EnableInitSeed": true, // 启用种子初始化
// "EnableDiffLog": false, // 启用库表差异日志
// "EnableUnderLine": false // 启用驼峰转下划线
// "IsEncrypt": true, //是否加密
// "DbSecurity": "" //链接字符串解密密钥
//}
],
"AssemblysService": [] //需要DI的服务
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- Mapster (>= 7.4.0)
- Microsoft.Extensions.DependencyModel (>= 8.0.1)
- RuoVea.ExCache (>= 7.0.0)
- RuoVea.ExDto (>= 7.0.1)
- RuoVea.ExIdGen (>= 7.0.1)
- RuoVea.ExUtil (>= 7.0.1)
- RuoVea.SM (>= 7.0.0)
- SqlSugarCore (>= 5.1.4.167)
- System.Linq.Dynamic.Core (>= 1.4.5)
- System.Text.RegularExpressions (>= 4.3.1)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on RuoVea.ExSugar:
Package | Downloads |
---|---|
RuoVea.OmiApi.Config
参数配置接口 |
|
RuoVea.OmiApi.Dict
字典管理 |
|
RuoVea.OmiApi.Log
日志管理 |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.0.0.10 | 88 | 11/1/2024 |
8.0.0.9 | 82 | 10/26/2024 |
8.0.0.8 | 73 | 10/25/2024 |
8.0.0.7 | 86 | 10/10/2024 |
8.0.0.6 | 91 | 9/24/2024 |
8.0.0.5 | 95 | 9/22/2024 |
8.0.0.4 | 81 | 9/22/2024 |
8.0.0.3 | 98 | 9/19/2024 |
8.0.0.2 | 111 | 9/11/2024 |
8.0.0.1 | 109 | 8/29/2024 |
8.0.0 | 110 | 8/28/2024 |
7.0.0.10 | 72 | 11/1/2024 |
7.0.0.9 | 74 | 10/26/2024 |
7.0.0.8 | 69 | 10/25/2024 |
7.0.0.7 | 91 | 10/10/2024 |
7.0.0.6 | 83 | 9/24/2024 |
7.0.0.5 | 90 | 9/22/2024 |
7.0.0.4 | 93 | 9/22/2024 |
7.0.0.3 | 89 | 9/19/2024 |
7.0.0.2 | 107 | 9/11/2024 |
7.0.0.1 | 103 | 8/29/2024 |
7.0.0 | 106 | 8/28/2024 |
6.0.18.13 | 1,551 | 11/1/2024 |
6.0.18.12 | 416 | 10/26/2024 |
6.0.18.11 | 78 | 10/25/2024 |
6.0.18.10 | 246 | 10/10/2024 |
6.0.18.9 | 576 | 9/24/2024 |
6.0.18.8 | 163 | 9/22/2024 |
6.0.18.7 | 97 | 9/19/2024 |
6.0.18.6 | 157 | 9/11/2024 |
6.0.18.5 | 115 | 8/29/2024 |
6.0.18.4 | 95 | 8/28/2024 |
6.0.18.3 | 120 | 8/25/2024 |
6.0.18.2 | 141 | 3/13/2024 |
6.0.18.1 | 135 | 3/13/2024 |
6.0.18 | 259 | 3/25/2023 |
6.0.17 | 242 | 3/25/2023 |
6.0.16 | 242 | 3/25/2023 |
6.0.15 | 254 | 3/24/2023 |
6.0.13 | 233 | 3/15/2023 |
6.0.12 | 232 | 3/14/2023 |
6.0.11 | 250 | 3/14/2023 |
6.0.10 | 277 | 3/11/2023 |
6.0.9 | 503 | 8/22/2022 |
6.0.8 | 471 | 8/18/2022 |
6.0.7 | 450 | 8/17/2022 |
6.0.6 | 476 | 8/16/2022 |
6.0.5 | 492 | 7/5/2022 |
6.0.4 | 496 | 7/5/2022 |
6.0.3 | 525 | 6/10/2022 |
6.0.2 | 566 | 4/11/2022 |
6.0.1 | 575 | 4/11/2022 |
6.0.0 | 587 | 3/18/2022 |
5.0.1.5 | 75 | 11/1/2024 |
5.0.1.4 | 77 | 10/26/2024 |
5.0.1.3 | 72 | 10/25/2024 |
5.0.1.2 | 82 | 10/10/2024 |
5.0.1.1 | 89 | 9/24/2024 |
5.0.1 | 644 | 3/18/2022 |
5.0.0 | 561 | 3/18/2022 |