public void DeleteCustomersByAddress(string address) { using (RetailEntities context = new RetailEntities()) { List <Customer> entities = context.Customers.AsQueryable().Where(c => c.Address == address).ToList(); foreach (var entity in entities) { context.Set <Customer>().Remove(entity); } context.SaveChanges(); } }
public void DeleteCustomersByAddress(string address) { using (RetailEntities context = new RetailEntities()) { List<Customer> entities = context.Customers.AsQueryable().Where(c => c.Address == address).ToList(); foreach (var entity in entities) { context.Set<Customer>().Remove(entity); } context.SaveChanges(); } }
public void DeleteAllCustomers() { using (RetailEntities context = new RetailEntities()) { List <Customer> entities = context.Customers.AsQueryable().ToList(); foreach (var entity in entities) { context.Set <Customer>().Remove(entity); } context.SaveChanges(); //context.ExecuteStoreCommand("TRUNCATE TABLE [RETAIL].[STORE].[Customer]"); } }
public void DeleteAllCustomers() { using (RetailEntities context = new RetailEntities()) { List<Customer> entities = context.Customers.AsQueryable().ToList(); foreach (var entity in entities) { context.Set<Customer>().Remove(entity); } context.SaveChanges(); //context.ExecuteStoreCommand("TRUNCATE TABLE [RETAIL].[STORE].[Customer]"); } }