SqlSugarUtility 1.0.16

dotnet add package SqlSugarUtility --version 1.0.16
                    
NuGet\Install-Package SqlSugarUtility -Version 1.0.16
                    
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="SqlSugarUtility" Version="1.0.16" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SqlSugarUtility" Version="1.0.16" />
                    
Directory.Packages.props
<PackageReference Include="SqlSugarUtility" />
                    
Project file
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 SqlSugarUtility --version 1.0.16
                    
#r "nuget: SqlSugarUtility, 1.0.16"
                    
#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 SqlSugarUtility@1.0.16
                    
#: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=SqlSugarUtility&version=1.0.16
                    
Install as a Cake Addin
#tool nuget:?package=SqlSugarUtility&version=1.0.16
                    
Install as a Cake Tool

SqlSugarUtility

Build status MyGet NuGet MIT License

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SqlSugarUtility:

Package Downloads
SqlSugarUtility.Extensions

A powerful extension toolkit for SqlSugar ORM. Provides a flexible client factory with easy configuration (singleton/scope), integrates Yitter SnowFlake ID generator, and offers rich extension methods for SimpleClient and ISugarQueryable. Simplifies common data access patterns like paging, array conversion, and attribute-based entity mapping.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.16 109 5/12/2026
1.0.14 112 2/24/2026
1.0.13 232 8/15/2025
1.0.12 219 8/15/2025
1.0.11 255 5/8/2025
1.0.10 237 4/30/2025
1.0.9 303 4/14/2025
1.0.8 307 4/14/2025
1.0.7 259 6/4/2024
1.0.6 267 4/25/2024
1.0.5 327 5/19/2023
1.0.4 331 4/14/2023
1.0.1 323 4/11/2023
1.0.0.2 228 4/25/2024
Loading failed

## 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.