出现错误
一个或多个实体的验证失败。有关更多详细信息,请参见“ EntityValidationErrors”属性。
当我触发SaveChangesAsync()
函数时。请参阅下面的代码:
using (var context = new CommonDBContext()) {
var bbrs = await context.Table1
.ToListAsync();
var lastIndexToRemove = pimc.Result.IndexOf("UIX/");
if (lastIndexToRemove > -1)
{
bbrPimcStr = pimc.Result.Remove(0, lastIndexToRemove);
}
foreach (var bbr in bbrs) {
bbr.XBBR = xbbrStr;
bbr.LastUpdated = DateTime.Now;
bbr.LastUpdatedBy = userId;
if (!pimc.HasError)
{
var graveDKI = context.graveDKIStore
.Where(x => x.RefId == bbr.Id)
.FirstOrDefault();
if (graveDKI != null)
graveDKI.GraveDKI = bbrPimcStr ;
else
context.graveDKIStore.Add(new graveDKIStore
{
Id = Guid.NewGuid(),
GraveDKI = bbrPimcStr ,
RefId = bbr.Id,
MsgType = "PPIXFFT"
});
}
}
return await context.SaveChangesAsync(); // Got issue here
有人可以告诉我我的代码有什么问题吗?谢谢。
答案 0 :(得分:0)