I'm using Self Servicing version 2.6
How would I perform a cascading delete of the [Menu Category] object given the schema below
[Menu Category] contains zero or more [Menu Item(s)]
[Menu Item] contains zero or more [Menu Price(s)]
I'm trying to do this strictly with the generated code. Below is an example of what I am trying. Not only does it not work, but I think there's got to be a more efficient way.
MenuPriceCollection prices = new MenuPriceCollection();
RelationPredicateBucket bucket0 = new RelationPredicateBucket();
bucket0.Relations.ObeyWeakRelations = true;
bucket0.Relations.Add(MenuCategoryEntity.Relations.MenuItemEntityUsingCategoryId);
bucket0.Relations.Add(MenuItemEntity.Relations.MenuPriceEntityUsingItemId);
bucket0.PredicateExpression.Add(MenuCategoryFields.Id == categoryId);
prices.DeleteMulti(bucket0.PredicateExpression, bucket0.Relations);
MenuItemCollection items = new MenuItemCollection();
RelationPredicateBucket bucket1 = new RelationPredicateBucket();
bucket1.Relations.ObeyWeakRelations = true;
bucket1.Relations.Add(MenuCategoryEntity.Relations.MenuItemEntityUsingCategoryId);
bucket1.PredicateExpression.Add(MenuCategoryFields.Id == categoryId);
items.DeleteMulti(bucket1.PredicateExpression, bucket0.Relations);
MenuCategoryCollection categories = new MenuCategoryCollection();
IPredicateExpression deleteFilter = new PredicateExpression(MenuCategoryFields.Id == categoryId);
categories.DeleteMulti(deleteFilter);