Castle ActiveRecord Table name conflict

孤街浪徒 提交于 2020-01-04 02:34:07

问题


When you run into a reserved word like "User" in NHibernate you would just put single quotes around the offending text and nHibernate will surround the text with square brackets for querying. My question is how do you do the same thing using Castle.ActiveRecord?


回答1:


Actually, the portable way to express this is using backticks, e.g.:

[ActiveRecord("`User`")]
class User {}

From the NHibernate Column class:

If a value is passed in that is wrapped by ` then NHibernate will Quote the column whenever SQL is generated for it. How the column is quoted depends on the Dialect.




回答2:


Ok figured it out:

[ActiveRecord("[User]")]
    public class User : ActiveRecordBase


来源:https://stackoverflow.com/questions/2752072/castle-activerecord-table-name-conflict

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