Map DbType.Date to DateOnly on targets where it's available - #281
Conversation
|
@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 ab72769 which introduces a new AppContext switch to restore the previous behaviour of mapping AppContext.SetSwitch("Sylvan.Data.MapDbDateToClrDateTime", true);This allows to move forward with the new |
|
EF Core 8 went with a breaking change regarding this topic too. SQL Server |
32224b6 to
57f0630
Compare
…Time
The behaviour of mapping mapping DbType.Date to DateTime (instead of DateOnly) can be restored by setting the new `Sylvan.Data.MapDbDateToClrDateTime` AppContext switch.
```csharp
AppContext.SetSwitch("Sylvan.Data.MapDbDateToClrDateTime", true);
```
It would probably a good idea to merge MarkPflug/Sylvan.Data.Excel#198 first, though.