Delete subitems / children

Dec 31, 2014 at 4:02 PM
Hi,
Which the diffrent approch used by this Generic Framework to delete the item with his subitems ?
Can you give me an Example of codes ?

Does this operation (Delete subitems , children ) requied configure EF and/or Sql to do a cascading delete ?
Any help will be appreciated.
Coordinator
Jan 2, 2015 at 10:03 AM
Quick read up: https://genericunitofworkandrepositories.codeplex.com/wikipage?title=Inserting%20a%20Complex%20Object%20Graph&referringTitle=Documentation, which you can set the object state at any layer of your object graph and perform different actions on your object graph with one transaction e.g deleting sub-items.

If you want to enforce cascading sub-items, do this as your normally would with your EF mappings.

e.g.
 modelBuilder.Entity<User>()
        .HasOptional(a => a.UserDetail)
        .WithOptionalDependent()
        .WillCascadeOnDelete(true);
Marked as answer by lelong37 on 1/2/2015 at 3:03 AM