diff --git a/FreeSql.Tests/FreeSql.Tests/ClickHouse/ClickHouseTest2.cs b/FreeSql.Tests/FreeSql.Tests/ClickHouse/ClickHouseTest2.cs
index 9bc76f415..b96e8e9d4 100644
--- a/FreeSql.Tests/FreeSql.Tests/ClickHouse/ClickHouseTest2.cs
+++ b/FreeSql.Tests/FreeSql.Tests/ClickHouse/ClickHouseTest2.cs
@@ -8,11 +8,14 @@ using System.Diagnostics;
using System.ComponentModel.DataAnnotations;
using FreeSql.DataAnnotations;
using Xunit;
+using Xunit.Abstractions;
namespace FreeSql.Tests.ClickHouse
{
public class ClickHouseTest2
{
+
+
private static IFreeSql fsql = new FreeSqlBuilder().UseConnectionString(DataType.ClickHouse,
"Host=127.0.0.1;Port=8123;Database=test;Compress=True;Min Pool Size=1")
.UseMonitorCommand(cmd => Console.WriteLine($"线程:{cmd.CommandText}\r\n"))
@@ -29,6 +32,7 @@ namespace FreeSql.Tests.ClickHouse
{
fsql.CodeFirst.SyncStructure(typeof(PositionInfoModel));
}
+
[Fact]
public void Issuse1587TestOnePrimary()
{
diff --git a/FreeSql.Tests/FreeSql.Tests/ClickHouse/ClickHouseTest3.cs b/FreeSql.Tests/FreeSql.Tests/ClickHouse/ClickHouseTest3.cs
new file mode 100644
index 000000000..fc990939c
--- /dev/null
+++ b/FreeSql.Tests/FreeSql.Tests/ClickHouse/ClickHouseTest3.cs
@@ -0,0 +1,87 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using FreeSql.DataAnnotations;
+using Xunit;
+using Xunit.Abstractions;
+
+namespace FreeSql.Tests.ClickHouse
+{
+ public class ClickHouseTest3
+ {
+ private static ITestOutputHelper _output;
+ private static IFreeSql _fsql;
+
+ public ClickHouseTest3(ITestOutputHelper output)
+ {
+ _output = output;
+ _fsql = new FreeSqlBuilder().UseConnectionString(DataType.ClickHouse,
+ "Host=192.168.1.123;Port=8123;Database=test;Compress=True;Min Pool Size=1")
+ .UseMonitorCommand(cmd => _output.WriteLine($"线程:{cmd.CommandText}\r\n"))
+ .UseNoneCommandParameter(false)
+ .Build();
+ }
+
+ ///
+ /// 测试bool类型映射
+ ///
+ [Fact]
+ public void TestBoolMappingSync()
+ {
+ _fsql.CodeFirst.SyncStructure(typeof(BoolMappingTest));
+
+ }
+
+ ///
+ /// 测试bool类型映射
+ ///
+ [Fact]
+ public void TestBoolMappingInsert()
+ {
+ _fsql.Insert(new BoolMappingTest
+ {
+ Name = "Tom",
+ Age = 20,
+ Id = Guid.NewGuid().ToString(),
+ IsDelete = true,
+ IsEnable = true
+ }).ExecuteAffrows();
+
+ _fsql.Insert(new BoolMappingTest
+ {
+ Name = "Jess",
+ Age = 21,
+ Id = Guid.NewGuid().ToString(),
+ IsDelete = true,
+ IsEnable = false
+ }).ExecuteAffrows();
+
+ _fsql.Insert(new BoolMappingTest
+ {
+ Name = "Daily",
+ Age = 22,
+ Id = Guid.NewGuid().ToString(),
+ IsDelete = true,
+ IsEnable = null
+ }).ExecuteAffrows();
+ }
+
+ }
+
+ [Table(Name = "table_test_bool")]
+ public class BoolMappingTest
+ {
+ [Column(IsPrimary = true, Name = "id")]
+ public string Id { set; get; }
+
+ [Column(Name = "name")] public string Name { get; set; }
+
+ [Column(Name = "age")] public int Age { get; set; }
+
+ [Column(Name = "is_delete")] public bool IsDelete { get; set; }
+
+ [Column(Name = "is_enable")] public bool? IsEnable { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Providers/FreeSql.Provider.ClickHouse/ClickHouseUtils.cs b/Providers/FreeSql.Provider.ClickHouse/ClickHouseUtils.cs
index 126b0704d..c2ec76341 100644
--- a/Providers/FreeSql.Provider.ClickHouse/ClickHouseUtils.cs
+++ b/Providers/FreeSql.Provider.ClickHouse/ClickHouseUtils.cs
@@ -43,8 +43,9 @@ namespace FreeSql.ClickHouse
if (col.DbScale != 0) ret.Scale = col.DbScale;
break;
}
- if (value is bool)
- ret.Value = (bool)value ? 1 : 0;
+ //直接使用Bool
+ //if (value is bool)
+ // ret.Value = (bool)value ? 1 : 0;
}
_params?.Add(ret);
return ret;