public void Add(Order order)
 {
     using (var connection = new SqlConnection(SqlConnectionLocator.LocalhostSqlExpress())) {
         connection.Execute(SqlQueries.InsertOrderQuery, order);
         connection.Execute(SqlQueries.InsertOrderLineQuery, order.Lines);
     }
 }
 public void Add(Order order)
 {
     using (var dataContext = new DataContext()) {
         dataContext.Set<Order>().Add(order);
         dataContext.SaveChanges();
     }
 }
 public void Update(Order order)
 {
     using (var connection = new SqlConnection(SqlConnectionLocator.LocalhostSqlExpress())) {
         connection.Execute(SqlQueries.UpdateOrderQuery, order);
         connection.Execute(SqlQueries.DeleteOrderLineQuery, new {OrderId = order.Id});
         connection.Execute(SqlQueries.InsertOrderLineQuery, order.Lines);
     }
 }
 public void Update(Order order)
 {
     using (var dataContext = new DataContext()) {
         dataContext.Entry(order).State = EntityState.Modified;
         order.Lines.ForEach(x => dataContext.Entry(x).State = EntityState.Added);
         dataContext.SaveChanges();
     }
 }