From 71bd231a4a6a4dbb47dfda3237f22b885c22d3d3 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 f252b6ac2..ed1a4448b 100644 --- a/src/DataStreamSuite/DataStreamCore/BlueData/BlueDataUtility.cs +++ b/src/DataStreamSuite/DataStreamCore/BlueData/BlueDataUtility.cs @@ -841,6 +841,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);