fluent nhibernate m-to-m with column

Posted by csetzkorn on Stack Overflow See other posts from Stack Overflow or by csetzkorn
Published on 2010-04-08T13:14:40Z Indexed on 2010/04/08 14:33 UTC
Read the original article Hit count: 414

Hi,

I am used to hbm files and started using fluent nhibernate recently.

Creating an m-to-m relationship between two entities A and B is quite simple

In A I create:

public virtual IList Bs { get; set; }

and then I use:

mapping.HasManyToMany(x => x.Bs);

That’s it and I can do:

A a = new A(); a.Bs.Add(b);

My problem is that I would like to have an additional column in my dedicated m-to-m database table which holds the two foreign keys. What is the simplest way to achieve this in FNH?

Would I have to create a dedicated entity for the m-to-m realtionship or is there a simpler solution?

Thanks.

Best wishes,

Christian

© Stack Overflow or respective owner

Related posts about fluent-nhibernate

Related posts about nhibernate