Hi guys,
I have TaxGroup table that is linked in a 1 : n relationship with a Tax table.
I have imported them into llblgen pro 3.1 and generated nhibernate classes and fluent mappings.
When I delete a Tax entity it also deletes the parent TaxGroup entity too. This was not not what I was expecting.
The code used to handle the delete is. Repository.Delete is really just a wrapper around Session.Delete().
public void Delete(int id)
{
var tax = GetById(id);
Repository.Delete(tax);
Repository.Flush();
}
Anyway, my question is this. Is deleting the child entity supposed to delete the parent entity? And if so, how can I use the generated code to delete just the child entity?
I have included the SQL and Fluent configs below. If I change the .Cascade.All() call to .Cascade.None() in the TaxMap class, it deletes the tax but not the parent taxgroup but I don't want to have to keep updating my fluent files.
Cheers