Fluent Nhibernate - How to specify table name

 ̄綄美尐妖づ 提交于 2020-01-02 08:09:52

问题


I just started learning Nhibernate and Fluent Nhibernate. I want to specify table name when I create my mapping class.

Entity name in application is "CustomerOrders" but in the oracle database, table name is "CUSTOMER_ORDERS".

I learnt from googling that I can use "WithTable" to specify database table name.

I am not sure how to use it and where as Vs2008 didn't find the method.

Thanks


回答1:


WithTable was renamed to Table for the 1.0 release. It was mentioned in the release notes (first bullet point).




回答2:


public class CustomerOrdersMap : IAutoMappingOverride<CustomerOrders>
    {
        public void Override(AutoMapping<CustomerOrders> mapping)
        {
            mapping.Table("CUSTOMER_ORDERS");


        }
    }


来源:https://stackoverflow.com/questions/1578729/fluent-nhibernate-how-to-specify-table-name

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