Now imagine that TransactionScope used a similar technique.
现在,假设TransactionScope使用了相似的技术。
In reality, the mechanism used by TransactionScope and SqlCommand is more complicated, but at its core the premise is sound.
实际上,TransactionScope和SqlCommand所使用的机制非常复杂,但核心是前提要合理。
Another use for thread-static fields, and one that brings us back to TransactionScope, is for passing out-of-band data between method calls.
线程静态字段的另外一种用法是(这又将我们带回到TransactionScope)用于在方法调用之间传递带外数据。
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。
应用推荐