数据库有问题

Having problems with database

本文关键字:有问题 数据库      更新时间:2023-10-16

在我的 c++ 程序中,我的程序遇到了问题,我一次通过数据库运行太多东西并收到错误。我该如何解决这个问题?

假设您已经使用服务器端代码更新了代码。这是解决死锁的一种方法。

首先,您需要了解默认情况下事务的实体框架隔离级别是可序列化的。下面是有关 SQL 服务器隔离级别的详细信息。

它指出,对于可序列化:

  • 在当前事务完成之前,任何其他事务都不能修改当前事务已读取的数据。

因此,您需要做的是将 EF 事务范围隔离级别更改为快照示例:

using (var scope = new TransactionScope(TransactionScopeOption.Required, new 
TransactionOptions { IsolationLevel= IsolationLevel.Snapshot }))
{
// do something with EF here
scope.Complete();
}
recordPayroll(): void {
return Observable.of(this.ptoData).mergeMap(ptoDataItem => { 
if (this.ptoDataItem.date < this.date && this.ptoDataItem.type != "Uncharged") {
this.ptoDataItem.inPR = true;
return this.ptoDataService.update(this.ptoDataItem);
} 
return Observable.empty();
}
}

不能保证这会起作用。我自己不使用 TS,也不习惯 RxJS。