Open
Description
问题描述及重现代码:
// c# code
public class AppInfoEntity
{
/// <summary>
/// 应用程序ID
/// </summary>
[Column(IsPrimary = true, Name = "APP_ID")]
public string AppID { get; set; }
/// <summary>
/// 应用程序名称
/// </summary>
[Column(Name = "APP_NAME")]
public string AppName { get; set; }
}
public async Task<bool> UpdateAppInfoAsync(AppInfoDto req)
{
var id = req.AppID;
var repo = _centralismRepository.AppInfoRepository;
var compareDic = new Dictionary<string, object[]>();
var updateInfo = "";
var info = await repo.Select.Where(info => info.AppID == id).FirstAsync();
if (info != null)
{
repo.Attach(info);
info = _mapper.Map<AppInfoEntity>(req);
compareDic = repo.CompareState(info);
if (compareDic.Count > 0)
{
foreach (var key in compareDic.Keys)
{
updateInfo += "修改应用: " + key + " 修改前:" + compareDic[key][1] + " 修改后:" + compareDic[key][0] + "\r\n";
}
}
await repo.UpdateAsync(info);
}
}
repo.CompareState(info); 报错 The given key 'APP_NAME' was not present inthe dictionary.
数据库版本
SQLServer 13.0.4001.0
安装的Nuget包
3.5.107
.net framework/. net core? 及具体版本
.net core 6
Metadata
Metadata
Assignees
Labels
No labels