cascade delete does not delete children (if they aren't loaded)

Issue #69 new
Former user created an issue

Version 1.3.0 (not currently listed in the Version menu)

Referring to the documentation in Overview relating to cascade delete, the following example code does not delete the Customer's Orders as described:

var customer = conn.Get<Customer>(1234);

// All orders for this customer WILL NOT be deleted from the database
conn.Delete(customer, recursive: true);

This however does work:

var customer = conn.Get<Customer>(1234);
conn.GetChildren<Customer>(customer, true);

// All orders for this customer WILL be deleted from the database
conn.Delete(customer, recursive: true);

Thank you for all of your great work!

Comments (3)

  1. Guillermo GutiƩrrez

    I'll update the documentation, but that's the intended behavior. Cascade delete operation currently only deletes the objects if they are already loaded in memory. However it's technically possible to implement this functionality the way you describe it, pull requests are always welcome ;)

  2. Sasan Pasha

    is the documentation updated with the intention you mentioned ? I was having the same problem and noticed the Cascade Delete only works when the object is fully loaded with children.

  3. Log in to comment