------解决方案--------------------
Basically, you were trying to update a detached entity. Here's what happened: you first extracted a customer entity from a context, but later you attempted to change that customer and open another context that customer.
The problem is: the second context had no idea of your customer entity extracted from the first context. If this is the way you want, you need to attach that customer back to the second context, by using: context.Attach(customer), and then, you must modify the customer's state to Modified, by using state manager.