Disclaimer: I am an NHibernate noobie so hopefully this question makes sense. I have a many-to-many relationship between two classes something like…
public class Entity1
{
public virtual Guid EntityId { get; set; }
public virtual IList<Entity2> Entity2List;
}
Public class Entity2
{
public virtual Guid EntityId { get; set; }
public virtual IList<Entity1> Entity1List;
}
I’ve added a many-to-many relationship with a bag in both class mappings, defining an association table but am unsure of which cascade option to use. I want to be able to create a new Entity1 instance, add a new Entity2 instance to it’s list, call Save, and both be inserted into the database (and vice-versa). When deleting an entity it should delete any associations to child entities but not the child entity itself. Should I be using cascade="save-update"?