Fluent NHibernate在多对一关系中生成无效列名称。
enter public EmployeeMap()
{
Id(x => x.EmployeeID);
Map(x => x.FirstName);
Map(x => x.LastName);
Map(x => x.City);
Map(x => x.HireDate);
Map(x => x.Title);
HasMany(x => x.Orders)
.WithForeignKeyConstraintName("EmployeeID")
.Inverse()
.Cascade.All();
}
由此产生的HBM:
<bag name="Orders" inverse="true" cascade="all">
<key foreign-key="EmployeeID" column="Employees_id" />
<one-to-many class="FluentWeb.Domain.Orders, FluentWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</bag>
注意“Employees_id”。我看过其他人使用方法“WithKeyColumn(”EmployeeID“)的帖子。这个方法不可用。我该怎么办?
由于
答案 0 :(得分:4)
以下似乎是解决方案:
.KeyColumnNames.Add("CustomerName")
-Nick