我使用 DB First 方法将最新的 EFCore 版本与 Postgres 数据库一起使用。从现有 Postgres 数据库生成 Dbcontext 时,它会从表名和列名中消除下划线 ('_')。
我正在使用以下命令生成 DbContext:
Scaffold-DbContext "Server=localhost;Port=5432;User Id=postgres;Password=mypassword;Database=SAMPLE_db;" Npgsql.EntityFrameworkCore.PostgreSQL -o DbModels -Schemas "local_dev"