I’m trying to upgrade from .NET 7 to .NET 8. I have a database-first EF setup. Some values are type changed to enum values via my T4. In .NET 7, this all works beautifully. Some of these values also have default constraints in our database. In EF 8, the scaffolder decides that instead of using HasDefaultValueSql (which would be correct in 100% of instances, since the default value lives in the database), it should use HasDefalutValue, which is not correct for the now-enum values. Same issue this guy on GitHub is having, for greater context. Is there a way in the T4 or otherwise to programmatically replace the HasDefaultValue with HasDefaultValueSql? The way this is currently, this is a breaking change for us, despite not being listed on the EF 8 breaking changes list.
Before you suggest it, yes, I know removing the default constraints entirely is a solution, however, that is not something the powers that be want to do, or that I really want to do for that matter.
I tried removing the HasDefaultValue line entirely, which I was able to do from the T4, however, that does not fix the issue. I tried to do a string replace of HasDefaultValue with HasDefaultValueSql in the T4, but that appeared to do nothing:
propertyFluentApiCalls.Method.Replace("HasDefaultValue", "HasDefaultValueSql");