22 lines
719 B
C#
22 lines
719 B
C#
|
using SqlSugar;
|
|||
|
|
|||
|
namespace ZhiYi.Core.Application.SqlClient
|
|||
|
{
|
|||
|
public class SugarClientInit
|
|||
|
{
|
|||
|
public readonly static SugarClientInit Instance = new SugarClientInit();
|
|||
|
|
|||
|
public SqlSugarClient GetDdClient(string connStr)
|
|||
|
{
|
|||
|
|
|||
|
return new SqlSugarClient(new ConnectionConfig
|
|||
|
{
|
|||
|
ConnectionString = connStr,
|
|||
|
DbType = DbType.PostgreSQL,
|
|||
|
IsAutoCloseConnection = true, //自动释放数据务,如果存在事务,在事务结束后释放
|
|||
|
InitKeyType = InitKeyType.Attribute //从实体特性中读取主键自增列信息 [SugarColumn(IsPrimaryKey=true,IsIdentity =true)]
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
}
|