public static int BorrarObjetoT<T>(this T objeto) where T : Instrumental1 { int i = 0; using (ispDB db = new ispDB()) { try { db.BeginTransaction(); i = db.Delete(objeto); db.CommitTransaction(); } catch (Exception) { db.RollbackTransaction(); throw; } } return i; }
public static int BorrarListaT<T>(this List<T> lista) where T : Instrumental1 { int i = 0; int x = 0; using (ispDB db = new ispDB()) { try { db.BeginTransaction(); foreach (T item in lista) { i = db.Delete<T>(item); if (i == 0) i = x; } db.CommitTransaction(); } catch (Exception) { db.RollbackTransaction(); throw; } } return i; }