LLBLGen - DeleteMulti
Posted
by Neil
on Stack Overflow
See other posts from Stack Overflow
or by Neil
Published on 2010-04-05T16:13:18Z
Indexed on
2010/04/05
16:33 UTC
Read the original article
Hit count: 861
I have a checkboxlist of categories, during an update, I am trying to delete all the items in list from the associate table, then insert them all (so I don't have to determine if an item already exists in the associate table and only insert newly checked items). Here is the code I have:
// First we need to delete the records from ArticleTopicCategory where articleId is the id of the article we are updating
List<Guid> categoriesToDelete = new List<Guid>();
foreach (Guid category in this.View.SelectedCategories)
{
categoriesToDelete.Add(category);
}
ArticleTopicCategoryCollection articleCategories = new ArticleTopicCategoryCollection();
PredicateExpression filter = new PredicateExpression(ArticleTopicCategoryFields.Id == categoriesToDelete);
articleCategories.DeleteMulti(filter);
'categoriesToDelete' holds a valid list of Guid's that need to be deleted, but they are not being deleted.
Thanks in advance!
© Stack Overflow or respective owner