Fluent Nhibernate - How to specify table name

2019-05-10 17:58发布

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

2条回答
叼着烟拽天下
2楼-- · 2019-05-10 18:29
public class CustomerOrdersMap : IAutoMappingOverride<CustomerOrders>
    {
        public void Override(AutoMapping<CustomerOrders> mapping)
        {
            mapping.Table("CUSTOMER_ORDERS");


        }
    }
查看更多
Summer. ? 凉城
3楼-- · 2019-05-10 18:44

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

查看更多
登录 后发表回答