How to delete multiple records in linq with multiple conditions?
A:
Not sure to understand your problem, but you can get typed object you need with a simple linq query, then remove them on iteration
var objectsToRemove = ...
using(Datacontext context = ...)
{
using(TransactionScope scope = new TransactionScope())
{
objectsToRemove.foreach(entity=>
{
context.YourEntities.Attach(entity);
context.YourEntities.DeleteOnSubmit(entity);
context.SubmitChanges();
});
scope.Complete();
}
}
Xstahef
2009-07-21 13:36:52