diff --git a/ClickHouse.Client.Tests/Types/TypeMappingTests.cs b/ClickHouse.Client.Tests/Types/TypeMappingTests.cs index c97a404b..76b2d3f8 100644 --- a/ClickHouse.Client.Tests/Types/TypeMappingTests.cs +++ b/ClickHouse.Client.Tests/Types/TypeMappingTests.cs @@ -79,6 +79,9 @@ public class TypeMappingTests [TestCase(typeof(uint?), ExpectedResult = "Nullable(UInt32)")] [TestCase(typeof(uint?[]), ExpectedResult = "Array(Nullable(UInt32))")] [TestCase(typeof(string[][]), ExpectedResult = "Array(Array(String))")] +#if NET6_0_OR_GREATER + [TestCase(typeof(DateOnly), ExpectedResult = "Date")] +#endif [TestCase(typeof(Tuple), ExpectedResult = "Tuple(Int32,UInt8,Nullable(Float32),Array(String))")] public string ShouldConvertToClickHouseType(Type type) => TypeConverter.ToClickHouseType(type).ToString(); diff --git a/ClickHouse.Client/ClickHouse.Client.csproj b/ClickHouse.Client/ClickHouse.Client.csproj index 5c3c627a..100f568e 100644 --- a/ClickHouse.Client/ClickHouse.Client.csproj +++ b/ClickHouse.Client/ClickHouse.Client.csproj @@ -1,7 +1,7 @@  - net48;netstandard2.1;netcoreapp3.1;net5.0 + net48;netstandard2.1;netcoreapp3.1;net5.0;net6.0 true https://github.com/DarkWanderer/ClickHouse.Client https://github.com/DarkWanderer/ClickHouse.Client diff --git a/ClickHouse.Client/Types/TypeConverter.cs b/ClickHouse.Client/Types/TypeConverter.cs index 5f6ca489..56375050 100644 --- a/ClickHouse.Client/Types/TypeConverter.cs +++ b/ClickHouse.Client/Types/TypeConverter.cs @@ -171,6 +171,9 @@ static TypeConverter() // Mapping fixups ReverseMapping.Add(typeof(ClickHouseDecimal), new Decimal128Type()); ReverseMapping.Add(typeof(decimal), new Decimal128Type()); +#if NET6_0_OR_GREATER + ReverseMapping.Add(typeof(DateOnly), new DateType()); +#endif ReverseMapping[typeof(DateTime)] = new DateTimeType(); ReverseMapping[typeof(DateTimeOffset)] = new DateTimeType(); }