I am trying to delete records from EF by using this query:
public void ClearAllLocks(Lock LockObj)
{
var Stf = context.Locks.First(S => S.UserId == LockObj.UserId);
if (Stf == null)
{
return;
}
context.Locks.DeleteObject(Stf);
context.SaveChanges();
}
But I am only able to delete the first record and I know the reason as well (as I am using First), what should I write instead of First so that all the entries can be deleted.
Also you can use EntityFramework.Extended (search at NuGet):