字符串和MYSQL一样用法
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{
ConnectionString = Config.ConnectionString,//Master Connection
DbType = DbType.TDSQL,
IsAutoCloseConnection = true,
//个别特殊的数据库需要禁用Nvarchar
MoreSettings=new ConnMoreSettings() { DisableNarvchar=true }
});需要安装ODBC驱动
//注册DLL只执行一次就行
using SqlSugar;
using TDSQLForPGOBDCTest;
InstanceFactory.CustomAssemblies = new System.Reflection.Assembly[] {
typeof(SqlSugar.TDSQLForPGODBC.TDSQLForPGODBCAdapter).Assembly };
//创建db对象
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{
ConnectionString = Config.ConnectionString,//Master Connection
DbType = DbType.TDSQLForPGODBC,//PG模式用这个
IsAutoCloseConnection = true,
MoreSettings = new ConnMoreSettings()
{
PgSqlIsAutoToLower = false,//增删查改支持驼峰表
PgSqlIsAutoToLowerCodeFirst = false, // 建表建驼峰表。5.1.3.30
}
});
var list = db.Queryable<TSYS_USER>().ToList();
var page1 = db.Queryable<TSYS_USER>().ToOffsetPage(1, 30);
db.Insertable<TSYS_USER>(new TSYS_USER
{
U_ID = "DGSSqlsugar",
U_NAME = "杜国舜SqlSugar适配",
U_EMAIL = "dd2@"
}).ExecuteCommand();
db.Updateable<TSYS_USER>(new TSYS_USER
{
U_ID = "DGSSqlsugar",
U_NAME = "杜国舜SqlSugar适配,修改后",
U_EMAIL = "dd2@"
}).ExecuteCommand();
db.Deleteable<TSYS_USER>().Where(m => m.U_ID == "DGSSqlsugar").ExecuteCommand();
2016 © donet5.comApache Licence 2.0