Disable Table Name Double Quoting on FluentNhibernate

半城伤御伤魂 提交于 2019-12-02 01:48:38

问题


I am switching my application to Postgresql, All the tables in my schema are in lowercase and when I'm doing a query with NHibernate it is adding double quotes to the table name which on the mappings is in PascalCase and causing the query to fail telling me that the table does not exists.

I could easily go to all the mappings classes and change the Table method to be lowercase, like change from 'Table("UserAccount")' to 'Table("useraccount")' but I'd rather prefer not having to do this..

I was wondering if there is any way to tell nhibernate not to Double Quote the table on the queries so it'll find it correctly.

I tried with this:

PostgreSQLConfiguration.Standard.Raw("hbm2ddl.keywords","none").ConnectionString(x => x.Is(_connectionString));

and it did not work. I would pretty much tell nhibernate not to worry about case, but having trouble to do this with postgres.


回答1:


You could change this behavior using Fluent NHibernate's IClassConvention. I guess here is no other way to do it according to this question



来源:https://stackoverflow.com/questions/6283511/disable-table-name-double-quoting-on-fluentnhibernate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!