json 列更新需要手动设置
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
41a889f201
commit
5fdbdfec82
|
@ -911,6 +911,7 @@ namespace IRaCIS.Core.Application
|
||||||
_mapper.Map(trialConfig, trialInfo);
|
_mapper.Map(trialConfig, trialInfo);
|
||||||
trialInfo.UpdateTime = DateTime.Now;
|
trialInfo.UpdateTime = DateTime.Now;
|
||||||
|
|
||||||
|
_trialRepository.MarkAsModified(trialInfo, nameof(trialInfo.TrialObjectNameList));
|
||||||
|
|
||||||
//await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialConfig.TrialId && t.IsSigned == false, u => new ReadingQuestionCriterionTrial() { CriterionModalitys = trialConfig.Modalitys });
|
//await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialConfig.TrialId && t.IsSigned == false, u => new ReadingQuestionCriterionTrial() { CriterionModalitys = trialConfig.Modalitys });
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class IRaCISDBContext : DbContext
|
||||||
modelBuilder.Entity<Trial>(entity =>
|
modelBuilder.Entity<Trial>(entity =>
|
||||||
{
|
{
|
||||||
entity.Property(e => e.TrialObjectNameList).HasConversion(v => v == null ? "[]" : JsonConvert.SerializeObject(v),
|
entity.Property(e => e.TrialObjectNameList).HasConversion(v => v == null ? "[]" : JsonConvert.SerializeObject(v),
|
||||||
v => string.IsNullOrEmpty(v) ? null : JsonConvert.DeserializeObject<List<TrialObjectNameConfig>>(v));
|
v => string.IsNullOrEmpty(v) ? new List<TrialObjectNameConfig>() : JsonConvert.DeserializeObject<List<TrialObjectNameConfig>>(v));
|
||||||
});
|
});
|
||||||
|
|
||||||
#region pgsql codefirst 配置 暂时屏蔽
|
#region pgsql codefirst 配置 暂时屏蔽
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
void MarkAsModified<TFrom>(TFrom entity, string propertyName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ using IRaCIS.Core.Domain.Models;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
using IRaCIS.Core.Infrastructure.Extention;
|
using IRaCIS.Core.Infrastructure.Extention;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||||
using Microsoft.EntityFrameworkCore.Query;
|
using Microsoft.EntityFrameworkCore.Query;
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
|
@ -445,6 +446,15 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public void MarkAsModified<TFrom>(TFrom entity, string propertyName)
|
||||||
|
{
|
||||||
|
// 获取属性的元数据
|
||||||
|
var entry = _dbContext.Entry(entity);
|
||||||
|
|
||||||
|
// 设置指定属性为已修改
|
||||||
|
entry.Property(propertyName).IsModified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#region 异步查询
|
#region 异步查询
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue