Handle another Jet UNION quirk with NULL values. A string value could be returned when the store and expected type is a byte

pull/204/head
Christopher Jolly 2 years ago
parent 88b3cba005
commit 3f6cc90f8f

@ -115,6 +115,15 @@ namespace EntityFrameworkCore.Jet.Data
return checked((byte)ulongValue);
if (value is decimal decimalValue)
return (byte)decimalValue;
if (value is string stringvalue)
{
if (byte.TryParse(stringvalue, out var result))
{
return result;
}
var bt = Encoding.Unicode.GetBytes(stringvalue);
if (bt.Length > 0) return bt[0];
}
return (byte)value;
}

Loading…
Cancel
Save