Map `DbType.Date` to `DateOnly` on targets where it's available
It would probably a good idea to merge https://github.com/MarkPflug/Sylvan.Data.Excel/pull/198 first, though.
@0xced, I'm reluctant to merge this. I'd like to maintain consistent behavior between frameworks, and this would potentially cause a break if someone moved from an older framework to a new one that supports these new types. I agree with what you're trying to achieve though, as DateOnly feels like the more appropriate type for this scenario. I'm wondering if there is a way to accomplish this via the data binder instead, allowing DateTime values to be bound to DateOnly properties, maybe requiring that the time component is zero.
I just pushed ab727698d1d2d844a3c2d0bc07ae6745122dc522 which introduces a new AppContext switch to restore the previous behaviour of mapping DbType.Date to DateTime (instead of DateOnly).
AppContext.SetSwitch("Sylvan.Data.MapDateToDateTime", true);
This allows to move forward with the new DateOnly type while also providing an escape hatch if needed.
EF Core 8 went with a breaking change regarding this topic too.
SQL Server date and time now scaffold to .NET DateOnly and TimeOnly