Case insensitive name of tables and properties in Entity Framework 7

前端 未结 6 1846
萌比男神i
萌比男神i 2021-01-03 00:26

I use Entity Framework 7 with Npgsql adapter. Sql generated by EF seems like

SELECT \"r\".\"Id\", \"r\".\"Name\" FROM \"public\".\"Role\" AS \"r\"

6条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-03 01:15

    To do this, you would need to swap out the SQL generation service with your own, quote-less, lowercase version. To do this, you will need to understand how EF uses DI (try reading Understanding EF Services), and need to replace the service that generates SQL. In EF, this could be ISqlGenerationHelper, IMigrationsSqlGenerator, or IUpdateSqlGenerator depending on the circumstance..

提交回复
热议问题