我如何使用流畅的NHibernate映射为没有标识列的表指定?流利的nHibernate没有表中的标识列
我想是这样的:
public sealed class CustomerNewMap : ClassMap<CustomerNew>, IMap
{
public CustomerNewMap()
{
WithTable("customers_NEW");
Not.LazyLoad();
Not.Id(); // this is invalid...
Map(x => x.Username);
Map(x => x.Company);
}
}
我的意思是在数据库中没有定义主键(不要太多在数据库中定义)。
如果我尝试使用相同键(在您的示例x.Username中)的所有对象实际上是从数据库中检索到的第一个对象的副本。 – blindmeis 2010-09-13 11:27:29