You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 1, 2025. It is now read-only.
I have a SQLite database (for my integration tests). All the mapping is inferred from the EF Core mapping (no manual configuration/attributes).
When I use BulkCopy with BulkCopyOptions using UseParameters = true, a DateTime value gets written as an empty string to the SQLite database, although the DateTime value is set to a valid, non-default value.
GetMaxLength() returns indeed null, fallback of 0 is used.
As far as I tested, only SQLite is affected (SQL Server and Oracle look to work fine).
Debugging
Used the debug symbols and debugged it. At the mentioned line I set the value of length to null instead of 0. This fixed the issue for me in this debug run.
Theory
It seems for SQLite, this fallback causes Linq2db to not send anything. I guess, because in SQLite there is no DateTime type but it is represented (in my case) as TEXT, it trims the "text" to a length/size of 0 (fallback value). This leads to an empty string.
Expected
DateTime column value should not be cut down to an empty string but have a full date-time value.
Workaround
None that worked. Using UseParameters = false in BulkCopyOptions works for SQLite, but is inefficient in the real provider (Oracle).
I think in some way I can workaround it in the non-test implementation, but then the tests change the "unsuspecting" domain implementation which I dislike. So a fix would be appreciated.
Failed tries:
[Column(Length=50)] on property (ignored and without effect due to code mentioned above)
.HasMaxLength(50) in EF Core mapping (EF Core validation exception)