Files
Marc Gravell 6d48ef664a Re-enable DateOnly/TimeOnly support, fixing the defects that got it disabled (#2228)
DateOnly/TimeOnly support (#2051) was compiled out in 907a4d9 pending
#2071/#2072. This re-enables it with the root causes fixed, and teaches the
read paths that the date/time family has no IConvertible bridge - which box
a date or time column yields is a provider/version decision (Npgsql 10:
DateOnly/TimeOnly; SqlClient and Npgsql 9: DateTime/TimeSpan), so both
shapes must convert:

- GetFieldValue<T> is no longer demanded of a column whose reported type
  needs a family conversion (a datetime column into a DateOnly member was
  the #2072 breakage; SqlDecimal-style entries, where GetFieldValue from a
  differently-reported column is the whole point, keep it);
- the member, scalar and Parse<T> paths all convert DateOnly/TimeOnly <->
  DateTime/TimeSpan in both directions (IL for members, object-level
  elsewhere), fixing reads against Npgsql 10 date/time columns (#2226);
- Query<DateOnly>/<TimeOnly> in scalar form no longer silently return
  default(T) (#2227): the typeMap entries make them simple types again;
- the same-TypeCode direct-unbox shortcut is restricted to distinct codes:
  TypeCode.Object matching TypeCode.Object says nothing (TimeSpan into
  TimeOnly? threw), while object on either side (sql_variant columns,
  dynamic members) keeps the direct unbox;
- the scalar conversion fallback keeps Convert.ChangeType's strict null
  contract (TestConversionExceptionMessages pins it).

The parked DateTimeOnlyTests are re-enabled, with new tests for the #2072
shape (datetime column into DateOnly member), the #2227 scalar shape, and
date-as-DateTime regression guards; PostgresqlTests gains the Npgsql-10
interchange matrix ([FactPostgresql], so it runs where the documented
container is available).

Fixes #2072, #2226, #2227, #1728; expected to also resolve #2071.
2026-08-20 15:20:51 +01:00
..
2023-09-12 15:58:49 +01:00
2020-10-11 14:56:35 -04:00
2023-09-12 15:58:49 +01:00
2023-09-12 15:58:49 +01:00
2026-04-29 08:38:12 +01:00
2023-09-12 15:58:49 +01:00
2020-10-11 14:56:35 -04:00
2020-10-11 14:56:35 -04:00
2023-09-12 15:58:49 +01:00
2023-09-12 15:58:49 +01:00
2020-11-17 09:57:17 +00:00