Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有:
session.Get<User>(id, LockMode.Upgrade)
第一个线程通过。第二块。我想测试这个锁,如果被锁就退出。
我该怎么办?
LockMode.UpgradeNoWait(仅当您的 SQL 服务器支持时才支持)?
LockMode.UpgradeNoWait
或者,您可以使用事务超时来实现类似的事情,但延迟时间更长。