views:

20

answers:

1

Hello

What is the equivalent to:

DELETE * from ProductsCategories WHERE ProductID = 78

using entity framework 3.5sp1? Need to delete all categories that belongs to a product.

/M

+1  A: 

I have used code similar to this to delete records.

var productCategories = from pc in context.ProductCatgories
     where pc.ProductID == 78;
foreach(var category in productCategories)
{
    context.DeleteObject(category);
}

context.SaveChanges();
DaveB