mccj - SqlSugarUtility 1.0.6

Package Description

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

Copy to clipboard

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

Copy to clipboard

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

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

nuget SqlSugarUtility  ~> 1.0.6
Copy to clipboard

> choco install SqlSugarUtility --version 1.0.6 --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.6" -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.152)
    • System.ComponentModel.Annotations (>= 5.0.0)
  • .NETStandard 2.1
    • SqlSugarCore (>= 5.1.4.152)
    • System.ComponentModel.Annotations (>= 5.0.0)
  • .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

0 total downloads
0 downloads for version 1.0.6
Download (15.77 KB)
Download symbols (12.42 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
1.0.6 15.77 KB Thu, 25 Apr 2024 04:47:57 GMT 0
1.0.0.2 15.77 KB Thu, 25 Apr 2024 04:32:20 GMT 0