public void InsertCustomerWithAddRangeWithoutTransaction(IEnumerable <Customer> customers)
 {
     using (var ebayDatabaseFirstContext = new EbayDatabaseFirstDbContext())
     {
         ebayDatabaseFirstContext.Customer.AddRange(customers);
         ebayDatabaseFirstContext.SaveChanges();
     }
 }
 public void InsertAddressWithAddRangeWithoutTransaction(IEnumerable <Address> addresses)
 {
     using (var ebayDatabaseFirstContext = new EbayDatabaseFirstDbContext())
     {
         ebayDatabaseFirstContext.Address.AddRange(addresses);
         ebayDatabaseFirstContext.SaveChanges();
     }
 }
Esempio n. 3
0
 public void DeleteAddressesWithAuditing(IEnumerable <Address> addresses)
 {
     using (var ebayDatabaseFirstDbContext = new EbayDatabaseFirstDbContext())
     {
         ebayDatabaseFirstDbContext.Address.RemoveRange(addresses);
         ebayDatabaseFirstDbContext.SaveChanges();
     }
 }
 public void InsertAddressWithAddWithoutTransactionSaveChangesBefore(IEnumerable <Address> addresses)
 {
     using (var ebayDatabaseFirstContext = new EbayDatabaseFirstDbContext())
     {
         foreach (var address in addresses)
         {
             InsertAddressWithAdd(ebayDatabaseFirstContext, address);
             ebayDatabaseFirstContext.SaveChanges();
         }
     }
 }
 public void Save(Customer customer)
 {
     try
     {
         using (var ebayDatabaseFirstContext = new EbayDatabaseFirstDbContext())
         {
             ebayDatabaseFirstContext.Customer.Add(customer);
             ebayDatabaseFirstContext.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
        public void InsertCustomerAndAddressWithAddWithoutTransaction(IEnumerable <Customer> customers, IEnumerable <Address> addresses)
        {
            using (var ebayDatabaseFirstContext = new EbayDatabaseFirstDbContext())
            {
                foreach (var address in addresses)
                {
                    ebayDatabaseFirstContext.Address.Add(address);
                }

                foreach (var customer in customers)
                {
                    ebayDatabaseFirstContext.Customer.Add(customer);
                }

                ebayDatabaseFirstContext.SaveChanges();
            }
        }