SqlSugarUtility.Extensions
1.0.19
dotnet add package SqlSugarUtility.Extensions --version 1.0.19
NuGet\Install-Package SqlSugarUtility.Extensions -Version 1.0.19
<PackageReference Include="SqlSugarUtility.Extensions" Version="1.0.19" />
<PackageVersion Include="SqlSugarUtility.Extensions" Version="1.0.19" />
<PackageReference Include="SqlSugarUtility.Extensions" />
paket add SqlSugarUtility.Extensions --version 1.0.19
#r "nuget: SqlSugarUtility.Extensions, 1.0.19"
#:package SqlSugarUtility.Extensions@1.0.19
#addin nuget:?package=SqlSugarUtility.Extensions&version=1.0.19
#tool nuget:?package=SqlSugarUtility.Extensions&version=1.0.19
SqlSugarUtility
using SqlSugar;
public static class SqlSugarHelper
{
private static ISqlSugarClient? _client = null;
public static ISqlSugarClient Db
{
get
{
if (_client == null)
{
var dbType = DbType.SqlServer;
//var connectionString = "Data Source=192.168.x.x;Initial Catalog=xxx;User ID=sa;PWD=xxx";
if (string.IsNullOrWhiteSpace(connectionString)) throw new Exception("连接字符串不能空");
_client = SqlSugarUtility.GetSingletonSqlSugarClient<IgnoreAttribute>(dbType, connectionString, false, db =>
{
//(A)全局生效配置点,一般AOP和程序启动的配置扔这里面 ,所有上下文生效
//调试SQL事件,可以删掉
db.Aop.OnLogExecuting = (sql, pars) =>
{
#if DEBUG
//Console.WriteLine(sql);//输出sql,查看执行sql 性能无影响
//5.0.8.2 获取无参数化 SQL 对性能有影响,特别大的SQL参数多的,调试使用
var sql2 = UtilMethods.GetSqlString(db.CurrentConnectionConfig.DbType, sql, pars);
Console.WriteLine(sql2);//输出sql,查看执行sql 性能无影响
System.Diagnostics.Debug.WriteLine(sql2);
#endif
};
db.Aop.OnError = (ex) =>
{
Console.WriteLine(ex.Message);//输出sql,查看执行sql 性能无影响
System.Diagnostics.Debug.Fail(ex.Message);
};
db.Aop.OnDiffLogEvent = (diff) =>
{
};
});
}
return _client;
}
}
}
public class IgnoreAttribute : Attribute { }
| 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. 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. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| .NET Framework | net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- SqlSugarUtility (>= 1.0.19)
-
.NETStandard 2.1
- SqlSugarUtility (>= 1.0.19)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
## v1.0.0
- 🚀 **SqlSugar Client Factory**: Simplified creation of SqlSugarScope and SqlSugarClient with built-in attribute mapping (Description, DefaultValue, Key, etc.).
- ❄️ **SnowFlake ID Integration**: Customizable SnowFlake ID generator (Yitter) configured by default.
- 🔧 **Convenience Extensions**: Added paging, counting, and array conversion methods for `SimpleClient` and `ISugarQueryable` (e.g., `ToPageList`, `ForEachByPage`, `GetArray`).
- 🧩 **Attribute Support**: Automatic recognition of common .NET attributes for database schema definition.