开发者

fluent map one to many

开发者 https://www.devze.com 2023-01-05 17:45 出处:网络
Class Person { int ID; IList<Cat> cats; } Class Cat { int OwnerId; } how to map person cats on nhibernate fluent?
Class Person  
{  
   int ID;
   IList<Cat> cats;  
}  

Class Cat  
{  
   int OwnerId;
}

how to map person cats on nhibernate fluent?

probably stupid question but i cant find the 开发者_开发百科answer..

thank you all.


How about:

public class PersonMap : ClassMap<Person>
{
   Id(p => p.ID);
   HasMany(p => p.Cats);
}

Assuming you have a Cats property in there somewhere of course.

0

精彩评论

暂无评论...
验证码 换一张
取 消