Closed Germs2004 closed 1 month ago
Sounds like an issue with your input data / csvhelper that is entirely unrelated to EF Core...
It's ok to close this issue if you think it's best. I just thought it was weird that a Non-Null property was being set to Null. I've fixed my issue another way, but sincerely, thank you for the great tool.
I will go ahead a close, since you found a workaround.
If you like my free tools, I would be very grateful for a rating or review on Visual Studio Marketplace or even a one-time or monthly sponsorship
Provide steps to reproduce a bug
If I create a not-null varchar column in my table, I notice EF Core Power Tools maps that to a not-null "string" datatype, but also sets its default value to "null!". If the column is supposed to be not-null, shouldn't it set the default value for those to string.Empty? If the current behavior is intended, can I configure it somehow to use string.Empty instead of null?
The issue I'm having is when writing these objects to database using CsvHelper. Since some properties are set to Null when the database doesn't allow nulls, it causes an error. Letting them default to string.Empty instead seems it would fix that.
Example table
EfPowerTools creates this Class:
Provide technical details
EF Core Power Tools version: 2.6.437
Exact Visual Studio version: Visual Studio 2022 17.11.3
Database engine: MariaDB 11.5
EF Core version in use: EF 8
Is Handlebars templates used: no
Is T4 templates used: no
Is a SQL Server .dacpac used: no