On a delete context with nHibernate, when deleting a parent with child collection I would like to know why Nhibernate do a delete line by line for children (on child PK)
DELETE FROM children where Id=1
DELETE FROM children where Id=2
...
DELETE FROM parent where id=1
Why nhibernate can't do
DELETE FROM children where parentId=1
DELETE FROM parent where id=1
It will be more efficient if parent have 100k children for example. I search in many topics without finding a correct anwser. I did some tests too but witout success An idea ?
That is a case, where we can use NHibernate extensibility points. The doc
19.3. Custom SQL for create, update and delete
So, if standard deletion is not useful, we can provide our own process, including some stored procedure
Summary, in most cases, the standard model is working and effective enough. In case we need to improve SQL .. we can ...