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" + }; +}