hi there,
i have several entities persisted with nhibernate. between some of them there are many-to-many relations with a bag, i.e. that the table looks like
Code:
table equipment_2_connection
vehicleID, int, not null
equipmentconnectionID, int, not null
where equipmentconnectionID is a foreign key to the EquipmentConnection's table ID and vehicleID is a foreign key to the Vehicle's ID column.
now i want to synchronize this data with microsoft sync framework. everything works fine, exception the many-to-many relation tables as i cannot enable change tracking (sql 2008) on them due to the fact that they do not contain a PK.
as i want the schema to be generated automatically from within nhibernate, i wonder if there is a way to tell nhibernate in my configuration to add a simple PK ID column...
my config for this relation looks something like this:
Code:
<bag name="Equipments" table="Equipment_2_Connection" cascade="save-update" lazy="false" >
<key column="VehicleID"/>
<many-to-many column="EquipmentConnectionID"
class="mynamespace.EquipmentConnection, mylibrary"/>
</bag>
EDIT: i'm sorry. i just answered my own question.
the solution was to substitute <bag> with an <idbag>. that's it. no magic, no foo, just a few lines of config.
thank's though ^^[/b]