I have a BLOG Table with COMMENTS Table with RESPONSES Table.
Example:
-
BLOG ONE
- COMMENTS=A
- Response 1
- Response 2
- COMMENT-B
- Response 1
- Response 2
- Response 3
- COMMENTS=A
-
BLOG TWO
- COMMENTS-A
- Response 1
- Response 2
- Response 3
- COMMENT-B
- Response 1
- Response 2
- COMMENTS-A
If we DELETE ‘BLOG TWO’ I need to delete all RESPONSE and all COMMENTS and the BLOG post as well.
I think the solution is to Delete all records returned from a .ToList(). This is what I am thinking/tried. I can seem to do a ‘IN’ list type of command.
ctx.BlogResponse.Where(b => b.blogCommentID = xxMyListItemxxx** ).ForEach(ctx.BlogResponse.DeleteObject);
How do I delete records from/contained within a .ToList()?
I found ‘.DeleteObject’ that deleted items contained within a returned LIST. I was able to do a few calls and it worked fairly well.
The .ForEach is something I haven’t used before and in this case, it works.