0
我想用fluentnhibernate映射接口和具体类。用FluentNHibernate映射接口和具体类
这里是我的接口/类:
public interface IUser
{
int Id { get; set; }
}
public class User: IUser
{
public int Id { get; set; }
public string Name { get; set; }
public string Password { get; set; }
}
这里是我的映射文件:
public class IUserMap: ClassMap
{
public IUserMap()
{
Table("User");
Id(u => u.Id)
.Column("Id")
.GeneratedBy.Native();
}
}
public class UserMap: SubclassMap
{
public UserMap()
{
Map(u => u.Name);
Map(u => u.Password);
}
}
,我得到这个错误:
could not execute query [ SELECT this_.Object_id as Id3_0_, this_.Name as Name4_0_, this_.Password as Password4_0_ FROM "User" this_ inner join User this_1_ on this_.Object_id=this_1_.Id WHERE this_.Name = @p0 ] Positional parameters: #0>test [SQL: SELECT this_.Object_id as Id3_0_, this_.Name as Name4_0_, this_.Password as Password4_0_ FROM "User" this_ inner join User this_1_ on this_.Object_id=this_1_.Id WHERE this_.Name = @p0]
...
通知“this_.Object_id”列是l ooking ...这不是我的ID列,但我不能指定一个Id(“my_id_column”);在子类地图
我做错了什么?
将KeyColumn(“Id”)添加到我的子SubclassMap工作。我也会为object_id问题打开一张票。 谢谢,詹姆斯! –
2009-11-05 13:12:32