c# - NHibernate many to many mapping join by custom columns -


i have 2 tables counter , group want link intermediate counter_to_group table.

counter [id, version, packageid, ...] group [id, ...] counter_to_group [counter_id, counter_version, counter_packageid, group_id] 

inside counter object want have list of groups:

public ienumerable<group> groups {get; set;} 

how can map fluent nhibernate?

as have additional properties on relation, need specific entity (or component) in business model represent them.

counter -(one-to-many)-> countertogroup -(many-to-one)-> group 

the countertogroup may component (it called composite-element in xml mapping). advantage of component has no identity , doesn't have explicitly added/removed database. cannot exist without parent. (on other hand cannot shared between different instances of counter, not want.)


Comments