mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 21:56:03 +08:00
Update PgSql
This commit is contained in:
parent
0dda259d6d
commit
1f4217876c
46
Src/Asp.Net/PgSqlTest/Bugs/BugTest3.cs
Normal file
46
Src/Asp.Net/PgSqlTest/Bugs/BugTest3.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest.Test
|
||||
{
|
||||
public class BugTest
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
SqlSugarClient Db = new SqlSugarClient(new ConnectionConfig()
|
||||
{
|
||||
ConnectionString = @"PORT=5433;DATABASE=x;HOST=localhost;PASSWORD=haosql;USER ID=postgres",
|
||||
DbType = DbType.PostgreSQL,
|
||||
IsAutoCloseConnection = true,
|
||||
|
||||
InitKeyType = InitKeyType.Attribute,
|
||||
});
|
||||
//调式代码 用来打印SQL
|
||||
Db.Aop.OnLogExecuting = (sql, pars) =>
|
||||
{
|
||||
Console.WriteLine(sql);
|
||||
};
|
||||
|
||||
Db.CodeFirst.InitTables(typeof(testmmmm12));
|
||||
|
||||
var id = Db.Insertable(new testmmmm12 { name="a", isok=true }).ExecuteReturnIdentity();
|
||||
var list = Db.Queryable<testmmmm12>().InSingle(id);
|
||||
var x = Db.Queryable<testmmmm12>().Where(it => !it.isok).ToList();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class testmmmm12
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey =true,IsIdentity =true)]
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public bool isok { get; set; }
|
||||
}
|
||||
|
||||
}
|
@ -61,6 +61,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Bugs\BugTest.cs" />
|
||||
<Compile Include="Bugs\BugTest3.cs" />
|
||||
<Compile Include="Bugs\BugTest2.cs" />
|
||||
<Compile Include="Demo\Demo0_SqlSugarClient.cs" />
|
||||
<Compile Include="Demo\Demo1_Queryable.cs" />
|
||||
|
@ -322,6 +322,10 @@ namespace SqlSugar
|
||||
properyTypeName = this.Context.Ado.DbBind.GetDbTypeName(propertyType.Name);
|
||||
}
|
||||
var dataType = dc.DataType;
|
||||
if (properyTypeName == "boolean" && dataType == "bool")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return properyTypeName != dataType;
|
||||
}
|
||||
#endregion
|
||||
|
@ -253,5 +253,10 @@ namespace SqlSugar
|
||||
{
|
||||
return "RANDOM()";
|
||||
}
|
||||
|
||||
public override string EqualTrue(string fieldName)
|
||||
{
|
||||
return "( " + fieldName + "=true )";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user