From afeb5babd4836092bdc8eba42ba3567f9b9725ed Mon Sep 17 00:00:00 2001 From: John Colvin Date: Fri, 31 Oct 2025 13:41:53 -0400 Subject: [PATCH] improve: Support enum types in ColumnInfo --- .../DataStreamCore/BlueData/BlueDataUtility.cs | 5 +++++ src/DataStreamSuite/DataStreamCore/BlueData/ColumnInfo.cs | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/DataStreamSuite/DataStreamCore/BlueData/BlueDataUtility.cs b/src/DataStreamSuite/DataStreamCore/BlueData/BlueDataUtility.cs index be8d8e4c4..d6da2b4e2 100644 --- a/src/DataStreamSuite/DataStreamCore/BlueData/BlueDataUtility.cs +++ b/src/DataStreamSuite/DataStreamCore/BlueData/BlueDataUtility.cs @@ -831,6 +831,11 @@ namespace BCG { if (kv.Value == t) return kv.Key; } + if (t.IsEnum) { + return get_typecode(t.GetEnumUnderlyingType()); + } else if (t.IsNullable()) { + return get_typecode(t.GetGenericArguments()[0]); + } //bts.Log.assert_d(false, $"type: {t} not found"); return TypeCode.Empty; } diff --git a/src/DataStreamSuite/DataStreamCore/BlueData/ColumnInfo.cs b/src/DataStreamSuite/DataStreamCore/BlueData/ColumnInfo.cs index c3c96b401..a53d13f1a 100644 --- a/src/DataStreamSuite/DataStreamCore/BlueData/ColumnInfo.cs +++ b/src/DataStreamSuite/DataStreamCore/BlueData/ColumnInfo.cs @@ -30,7 +30,10 @@ namespace BCG { type == typeof(long) || type == typeof(double) || type == typeof(string) || - type == typeof(DateTime); + type == typeof(DateTime) || + type == typeof(TimeSpan) || + (type.IsEnum && isAllowedType(type.GetEnumUnderlyingType())) || + (type.IsNullable() && isAllowedType(type.GetGenericArguments()[0])); public int CompareTo(ColumnInfo? other) => other is null ? 1 : colNo.CompareTo(other.colNo);