mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
修改DEMO
This commit is contained in:
parent
f26046e10a
commit
15043be49d
@ -2,29 +2,30 @@
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
|
|
||||||
|
|
||||||
SqlSugar.InstanceFactory.CustomNamespace = "SqlSugar.GaussDB";
|
//说明:GaussDB原生驱动访问数据库
|
||||||
SqlSugar.InstanceFactory.CustomDbName = "GaussDB";
|
|
||||||
SqlSugar.InstanceFactory.CustomDllName = "SqlSugar.GaussDBCore";
|
//这行代码扔程序启动时
|
||||||
|
InstanceFactory.CustomAssemblies = new System.Reflection.Assembly[] {
|
||||||
|
typeof(SqlSugar.GaussDBCore.GaussDBDataAdapter).Assembly };
|
||||||
|
|
||||||
//创建DB
|
//创建DB
|
||||||
var db = new SqlSugarClient(new ConnectionConfig()
|
var db = new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
ConnectionString = "PORT=5432;DATABASE=SqlSugar5Demo;HOST=localhost;PASSWORD=postgres;USER ID=postgres",
|
ConnectionString = "PORT=5432;DATABASE=SqlSugar5Demo;HOST=localhost;PASSWORD=postgres;USER ID=postgres",
|
||||||
DbType = SqlSugar.DbType.Custom,
|
DbType = SqlSugar.DbType.GaussDBNative,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
MoreSettings = new ConnMoreSettings()
|
MoreSettings = new ConnMoreSettings()
|
||||||
{
|
{
|
||||||
DatabaseModel = SqlSugar.DbType.OpenGauss
|
DatabaseModel = SqlSugar.DbType.OpenGauss
|
||||||
}
|
}
|
||||||
}, db =>
|
}, db =>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
db.Aop.OnLogExecuting = (x, y) =>
|
db.Aop.OnLogExecuting = (x, y) =>
|
||||||
{
|
{
|
||||||
Console.WriteLine(x);
|
Console.WriteLine(x);
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
db.Open();
|
db.Open();
|
||||||
db.Close();
|
db.Close();
|
||||||
|
Loading…
Reference in New Issue
Block a user