mccj - SqlSugarUtility 1.0.14

Package Description

PM> Install-Package SqlSugarUtility -Version 1.0.14 -Source https://www.myget.org/F/mccj/api/v3/index.json

Copy to clipboard

> nuget.exe install SqlSugarUtility -Version 1.0.14 -Source https://www.myget.org/F/mccj/api/v3/index.json

Copy to clipboard

> dotnet add package SqlSugarUtility --version 1.0.14 --source https://www.myget.org/F/mccj/api/v3/index.json

Copy to clipboard
<PackageReference Include="SqlSugarUtility" Version="1.0.14" />
Copy to clipboard
source https://www.myget.org/F/mccj/api/v3/index.json

nuget SqlSugarUtility  ~> 1.0.14
Copy to clipboard

> choco install SqlSugarUtility --version 1.0.14 --source https://www.myget.org/F/mccj/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "mccj" -SourceLocation "https://www.myget.org/F/mccj/api/v2"
Install-Module -Name "SqlSugarUtility" -RequiredVersion "1.0.14" -Repository "mccj" 
Copy to clipboard

Browse the sources in this package using Visual Studio or WinDbg by configuring the following symbol server URL: https://www.myget.org/F/mccj/api/v2/symbolpackage/


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 { }
  • .NETFramework 4.8
    • SqlSugar (>= 5.1.4.207)
    • System.ComponentModel.Annotations (>= 5.0.0)
    • Yitter.IdGenerator.Net45 (>= 1.0.0)
  • .NETStandard 2.1
    • SqlSugarCore (>= 5.1.4.214)
    • System.ComponentModel.Annotations (>= 5.0.0)
    • Yitter.IdGenerator (>= 1.0.15)
  • .NETFramework 4.8: 4.8.0.0
  • .NETStandard 2.1: 2.1.0.0

Owners

mccj

Authors

SqlSugarUtility

Project URL

https://github.com/mccj/SqlSugarUtility

License

Unknown

Info

49 total downloads
0 downloads for version 1.0.14
Download (22.85 KB)
Download symbols (14.59 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
1.0.14 22.85 KB Tue, 24 Feb 2026 09:47:35 GMT 0
1.0.13 17.82 KB Fri, 15 Aug 2025 06:07:06 GMT 6
1.0.12 17.87 KB Fri, 15 Aug 2025 02:53:22 GMT 6
1.0.11 17.89 KB Thu, 08 May 2025 02:26:14 GMT 6
1.0.10 17.88 KB Wed, 30 Apr 2025 05:51:59 GMT 9
1.0.8 16.98 KB Tue, 21 Jan 2025 05:50:10 GMT 13
1.0.7 16.35 KB Tue, 04 Jun 2024 08:32:00 GMT 9