예제 #1
0
 public async Task Delete(ICollection <T> entities)
 {
     foreach (var obj in entities)
     {
         EntityEntry dbEntity = Context.Entry(obj);
         if (dbEntity.State != EntityState.Deleted)
         {
             dbEntity.State = EntityState.Deleted;
         }
         else
         {
             DBSet.Attach(obj);
         }
     }
     await Task.Run(() => {
         DBSet.RemoveRange(entities);
     });
 }
예제 #2
0
 public IList <TEntity> DeleteAll(IEnumerable <TEntity> entities)
 {
     return(DBSet.RemoveRange(entities).ToList());
 }