我正在为我的网络商店使用nopcommerce,我使用的任务是从外部系统获得信息时,订单已经发送。当它发运时,我想捕获付款,然后将其设置为已发运。然而,我不断地得到EF错误。有什么办法能暂时绕过这件事吗?我需要让它启动并运行
实体对象不能被多个IEntityChangeTracker实例引用。
请参阅下面的代码:
int orderId = PBSManager.GetOrderIdByCustomOrderNumber(customOrderNumber);
NopObjectContext db = ObjectContextHelper.CurrentObjectContext;
Order order = db.Orders.SingleOrDefault(c => c.OrderId == orderId);
//Incorrect order id
if (order == null)
{
//Skip this one if we cannot find the id
continue;
}
if (OrderManager.CanCapture(order))
{
string error = string.Empty;
OrderManager.Capture(order, ref error);
if (!string.IsNullOrEmpty(error))
{
PBSManager.HandleCaptureError(order, error);
return;
}
}
if (OrderManager.CanShip(order))
{
OrderManager.Ship(order.OrderId, true);
}发布于 2010-11-26 14:35:28
发布于 2012-02-01 16:54:31
nopCommerce是否将当前上下文存储在HttpContext中,您是否尝试过在其中查找?
https://stackoverflow.com/questions/4285897
复制相似问题