Fluent Nhibernate - 一对多映射 - 与父级类型相同的子级
我有一个类定义为:
public class ReportClient
{
public virtual int? Id { get; set; }
public virtual long? ClientId { get; set; }
public virtual string Name { get; set; }
public virtual string EmailAddress { get; set; }
public virtual string AdditionalEmailAddress { get; set; }
public virtual List<ReportClient> ChildClients { get; set; }
}
如您所见,ChildClients 与 Parent 具有相同的类型。
请指导我如何为 List
有一个新表记录,该记录设置了“ParentId”列(ParentId = Id),
请指导。
谢谢你!
I have a class defined as:
public class ReportClient
{
public virtual int? Id { get; set; }
public virtual long? ClientId { get; set; }
public virtual string Name { get; set; }
public virtual string EmailAddress { get; set; }
public virtual string AdditionalEmailAddress { get; set; }
public virtual List<ReportClient> ChildClients { get; set; }
}
As you can see ChildClients are of same type as Parent.
Please guide me how can I map 'ChildClients' so for each ChildClient in List<ReportClient> ChildClients
there is a new table record with a column 'ParentId' being set for this record ( having ParentId = Id)
Please guide.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有要测试的环境,但这应该可行,如果不行,请尝试交换列名称。
I don't have the enviroment to test, but this should work, try swapping the column names if it doesn't.