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
I want my db tables and columns to be snake_cased in my postgres db as opposed to the C# standard of PascalCased for entity classes. Capitalization in postgres is a real pain, because you have to wrap everything in quotes for any manual or specialized queries, and we do a lot of that.
In the previous version of Npgsql.EntityFrameworkCore, I was able to do this by replacing the default versions of the ISqlGenerationHelper, IQuerySqlGenerator, and IHistoryRepository, and this worked swimmingly... but now everything is different and since updating to the latest and greatest this can't work any more.
What do I need to do now to change the casing of my column names and table names so that everything still works, but the entity FooBars with a FooId column renders, migrates, and reads like CREATE TABLE "foo_bars" ("foo_id" int... ?
The text was updated successfully, but these errors were encountered:
This question is best treated at a general EF Core level, rather than as an Npgsql provider question. It has been asked several times, and frankly the easiest way seems to be simply writing some code in your model's OnModelCreating() which goes over all your entities and properties and sets their their name to whatever you want. This is easy, portable and is much less brittle than replacer services in the provider.
Aside from that I'm not aware of any massive changes in the APIs of the services you mentioned above, so it's surprising you're into significant issues.
Am going to close as there's nothing to do here in the provider itself, but feel free to post more questions.
I want my db tables and columns to be
snake_cased
in my postgres db as opposed to the C# standard ofPascalCased
for entity classes. Capitalization in postgres is a real pain, because you have to wrap everything in quotes for any manual or specialized queries, and we do a lot of that.In the previous version of Npgsql.EntityFrameworkCore, I was able to do this by replacing the default versions of the
ISqlGenerationHelper
,IQuerySqlGenerator
, andIHistoryRepository
, and this worked swimmingly... but now everything is different and since updating to the latest and greatest this can't work any more.What do I need to do now to change the casing of my column names and table names so that everything still works, but the entity
FooBars
with aFooId
column renders, migrates, and reads likeCREATE TABLE "foo_bars" ("foo_id" int...
?The text was updated successfully, but these errors were encountered: