We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当执行完以下代码后,数据库的数据没更新,也没报错
var entitis = await _freeSql.Select<PositionGreetingConfigDo>(); var updateCofigs = new List<PositionGreetingConfigDo>(); var configEntity = entitis.First(x => x.positionGreetingConfigId == item.positionGreetingConfigId); configEntity.greetCount = item.greetingCount; configEntity.triggerTime = item.triggerTime; updateCofigs.Add(configEntity); using (var unitOfWork = _freeSql.CreateUnitOfWork()) { var repo = unitOfWork.GetRepository<PositionGreetingConfigDo>(); //更新 if (updateCofigs.Any()) { repo.Attach(updateCofigs); var r = repo.Update(updateCofigs); unitOfWork.Commit(); } }
sqlserver 12
FreeSql 3.2.832
.netcore3.1
The text was updated successfully, but these errors were encountered:
repo.Attach 不是这样用的,repo查询出来的记录,才适合用 repo.Update
如果记录来自是json,可以用 repo.Where(a=> items.Any(i => i.Id == a.Id)).ToList()
再 repo.Update(items),建议看文档了解仓储的机制。
也可以直接 repo.UpdateDiy.SetSource(items).ExecuteAffrows() 更新所有字段,这个API对应 fsql.Update修改文档。
Sorry, something went wrong.
No branches or pull requests
问题描述及重现代码:
当执行完以下代码后,数据库的数据没更新,也没报错
数据库版本
sqlserver 12
安装的Nuget包
FreeSql 3.2.832
.net framework/. net core? 及具体版本
.netcore3.1
The text was updated successfully, but these errors were encountered: