Cascade delete not working through fluent mapping

2 posts, 0 answers
  1. Vikash
    Vikash avatar
    14 posts
    Member since:
    Nov 2013

    Posted 10 Dec 2015 Link to this post

    Support Team,

    I am trying to configure cascade delete for models through Fluent mapping and BackEnd configuration, but neither of them is working. I had already followed but with no luck

    You can find sample application in the attachment for same to check the cause of it. Also, want to ask one more query, I have events on OpenAccessContext for Add/Delete/Update operation. I presume those should get triggered in a regular fashion in case of cascade delete as well, please let me know if you see any other problem with it.

    Thank You,
    Vikash Kumar.

  2. Boris Georgiev
    Boris Georgiev avatar
    190 posts

    Posted 14 Dec 2015 Link to this post

    Hello Vikash,

    If I understood correctly your scenario, you want when a "school" is deleted, all "teachers" associated to this "school" to be also deleted. If this is your scenario, you should set the IsDependent flag to the association between these classes. IsDependent flag should be set to association when you want to delete all of the child records of a parent record when the parent record is deleted. More information about IsDependent association you could find in this documentation article.
    Cascading delete in Telerik Data Access should be used when you have a multi-table entity, which means one class to be mapped to more than one table, then when you delete the object through the context, all table which are mapped to this class should be cleaned. 

    I hope that helps.

    Boris Georgiev
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  3. DevCraft banner
Back to Top