开发者

how do i automap an many-to-one relationship using fluent nhibernate

开发者 https://www.devze.com 2023-01-19 00:48 出处:网络
i have the following class: public class Worker { public int WorkerID {get;set;} public string Name { get;set;}

i have the following class:

public class Worker    
{
 public int WorkerID {get;set;}
 public string Name { get;set;}
}

public class TransferOrder
{
  public int TransferOrderID { get;set;}
  public Worker workerTobeTransfered{get;set;}

}

how do i automap this classe开发者_运维百科s in fluent nhibernate.


ok, after a few googling, i figured out the solution:

this is a many-to-one relation and it is mapped using Reference() Method, and the auto mapping already do that:

References<Worker>(m => m.Worker);

there is also a great article provide many examples of mapping situations which can be found Here.

0

精彩评论

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