From bf7cfe9bf17b8826a76c2d0abfa9490b4d455847 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Sat, 3 Jan 2026 16:11:00 -0500 Subject: [PATCH] feat(datasync): add JsonColumnSchema record for ETL column metadata --- .../Etl/Models/JsonColumnSchema.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 NEW/src/JdeScoping.DataSync/Etl/Models/JsonColumnSchema.cs diff --git a/NEW/src/JdeScoping.DataSync/Etl/Models/JsonColumnSchema.cs b/NEW/src/JdeScoping.DataSync/Etl/Models/JsonColumnSchema.cs new file mode 100644 index 0000000..2183968 --- /dev/null +++ b/NEW/src/JdeScoping.DataSync/Etl/Models/JsonColumnSchema.cs @@ -0,0 +1,25 @@ +namespace JdeScoping.DataSync.Etl.Models; + +/// +/// Defines a column schema for JSON-to-DataReader mapping. +/// +public record JsonColumnSchema( + string Name, + Type ClrType, + bool IsNullable = true) +{ + /// + /// Gets the SQL type name for this column (used in error messages). + /// + public string SqlTypeName => ClrType switch + { + Type t when t == typeof(string) => "VARCHAR", + Type t when t == typeof(int) => "INT", + Type t when t == typeof(long) => "BIGINT", + Type t when t == typeof(decimal) => "DECIMAL", + Type t when t == typeof(DateTime) => "DATETIME2", + Type t when t == typeof(bool) => "BIT", + Type t when t == typeof(byte[]) => "VARBINARY", + _ => "UNKNOWN" + }; +}