How does that SqlCommand know about the Transaction created earlier?
但SqlCommand如何知道先前创建的Transaction ?
In reality, the mechanism used by TransactionScope and SqlCommand is more complicated, but at its core the premise is sound.
实际上,TransactionScope和SqlCommand所使用的机制非常复杂,但核心是前提要合理。
You can imagine that TransactionScope could be using static fields to store the current Transaction and that SqlCommand could just be picking up that Transaction from that static field.
您可以假设TransactionScope可以使用静态字段来存储当前的Transaction,而SqlCommand只从该静态字段中获取相应Transaction。
You can imagine that TransactionScope could be using static fields to store the current Transaction and that SqlCommand could just be picking up that Transaction from that static field.
您可以假设TransactionScope可以使用静态字段来存储当前的Transaction,而SqlCommand只从该静态字段中获取相应Transaction。
应用推荐