您好我有下面這段代碼片段:EF 4不會更新db.SaveChanges數據庫記錄()
Paypal paypal = new Paypal();
paypal.Invoice = transactionID;
paypal.TxnType = "";
paypal.CreateDate = DateTime.Now;
paypal.AmountPaid = payment;
paypal.PaymentStatusId = paymentStatus;
db.Paypals.Add(paypal);
db.SaveChanges();
// Order Does not Update
Order order = _orderRepository.GetOrderByOrderId(orderId);
order.OrderStatusId = OrderStatusConstant.Paid;
order.PurchasedDate = DateTime.Now;
order.LastModified = DateTime.Now;
order.PaypalIpnId = paypal.PaypalIpnId;
db.SaveChanges();
// Cart Does not Update
Cart cart = _cartRepository.GetCartByCartId(order.CartId);
cart.Completed = true;
db.SaveChanges();
Order
和Cart
實體不更新。但插入了Paypal
對象。沒有錯誤或拋出任何異常,這被包含在try..catch
子句中。
這似乎是什麼問題?儲存庫代碼返回對象正常。
在調試模式下你什麼也得不到? – 2012-03-09 20:52:33