This is because nhibernate does not know which objects in the collection are new and old, so it must delete everything and then reinsert them.
, : ICollection HasManyToMany . :
public ScanDeliverySessionMap()
{
Id(x => x.Id);
...
...
HasManyToMany(x => x.ToScanForms)
.AsSet()
.Table("ToScanForm")
.ParentKeyColumn("SessionId")
.ChildKeyColumn("FormId").Cascade.SaveUpdate();
}
public FormMap()
{
Id(x => x.Id).Column("FormID").GeneratedBy.Foreign("Log");
....
....
HasManyToMany(x => x.ScanDeliverySessions)
.AsSet()
.Table("ToScanForm")
.ParentKeyColumn("FormId")
.ChildKeyColumn("SessionId").Inverse();
}
nhibernate HashSet Iesi Collections, , .