名为& quot; Order& quot;的DB列与流利的NHibernate

问题描述:

我发现我正在处理的旧数据库的一个表中有一个名为"Order"的列. 不幸的是,我无法更改数据库结构.
我的Fluent NHibernate类看起来像

I discovered that one of the tables of a legacy db I'm working on has a colum named "Order". Unfortunately I cannot change the DB structure.
My Fluent NHibernate class looks like

 public class SiteMap : AutoMap<Site>
{
    public SiteMap() {
        WithTable("Sites");
        Id(x => x.ID, "Id")
            .WithUnsavedValue(0)
            .GeneratedBy.Identity();
        Map(x => x.Name, "Name");
        //various columns mapping and then...
        Map(x => x.SiteOrder, "Order");
    }
}

我不知道问题是FluentNH还是NHibernate本身,但我可以确认问题出在"Order"保留名称上.

I do not know if the problems is FluentNH or NHibernate itself but I can confirm that the problem lies in the "Order" reserved name.

该如何解决?

更新:如建议的那样,以[订单]的形式填写.谢谢!
但是现在我只链接到SQL2005吗?

Update: as suggested putting in the form [Order] worked. Thanks!
But now I'm linked only to SQL2005?

尝试将Order放在后面的刻度中:"Order .由于FluentNH在运行时生成HBM文件,因此我想应该可以解决该问题.

Try putting Order in back ticks: ``Order. Since FluentNH is generating HBM files at runtime I imagine that should fix the problem.