efcore 重复跟踪问题解决,以及数组json列,无数据的时候会更新奇怪问题发现
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
0980db438f
commit
6114801959
|
|
@ -9497,6 +9497,16 @@
|
|||
评估原因
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.OncologyQuestion.ValueType">
|
||||
<summary>
|
||||
数值类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.OncologyQuestion.CustomUnit">
|
||||
<summary>
|
||||
自定义单位
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.OncologyQuestion.QuestionGenre">
|
||||
<summary>
|
||||
问题类型
|
||||
|
|
@ -9642,6 +9652,11 @@
|
|||
数值类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GlobalQuestionInfo.CustomUnit">
|
||||
<summary>
|
||||
自定义单位
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GlobalQuestionInfo.Type">
|
||||
<summary>
|
||||
类型
|
||||
|
|
@ -9782,6 +9797,16 @@
|
|||
字典code
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.JudgeQuestion.CustomUnit">
|
||||
<summary>
|
||||
自定义单位
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.JudgeQuestion.ValueType">
|
||||
<summary>
|
||||
数值类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReportVerifyOutDto.IsExistDisease">
|
||||
<summary>
|
||||
是否存在疾病
|
||||
|
|
@ -10697,6 +10722,16 @@
|
|||
问题英文名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.JudgeQuestionAnswerInfo.ValueType">
|
||||
<summary>
|
||||
数值类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.JudgeQuestionAnswerInfo.CustomUnit">
|
||||
<summary>
|
||||
自定义单位
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.JudgeQuestionAnswerInfo.ShowOrder">
|
||||
<summary>
|
||||
排序
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ using SixLabors.ImageSharp;
|
|||
using SixLabors.ImageSharp.Formats.Jpeg;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using System.Collections.Concurrent;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
|
@ -75,6 +76,56 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
public static int IntValue = 100;
|
||||
|
||||
public async Task<IResponseOutput> EfcoreTest11()
|
||||
{
|
||||
//更
|
||||
await _trialRepository.UpdatePartialFromQueryAsync(t => t.Id == Guid.Parse("08de572a-55c6-6503-0242-0a0001000000"), t => new Trial() { CreateTime = DateTime.Now },true);
|
||||
|
||||
await _trialRepository.UpdatePartialFromQueryAsync(t => t.Id == Guid.Parse("08DDACB9-B6CA-F21C-0242-0A0001000000"), t => new Trial() { CreateTime = DateTime.Now },true);
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
||||
}
|
||||
|
||||
public class ModelVerifyCommand
|
||||
{
|
||||
public int? IntNUllValue { get; set; }
|
||||
public int IntValue { get; set; }
|
||||
|
||||
public string StringValue { get; set; }
|
||||
|
||||
public string? StringNUllValue { get; set; }
|
||||
|
||||
public string StringBackDefaultValue { get; set; } = string.Empty;
|
||||
|
||||
public Guid GuidValue { get; set; } = NewId.NextSequentialGuid();
|
||||
|
||||
public Guid? GuidNUllValue { get; set; }
|
||||
|
||||
[NotDefault]
|
||||
public Guid GuidValueNotDefault { get; set; }
|
||||
|
||||
|
||||
public bool BoolValue { get; set; }
|
||||
|
||||
public bool? BoolNUllValue { get; set; }
|
||||
|
||||
public DateTime DateTimeValue { get; set; }
|
||||
|
||||
public DateTime? DateTimeNUllValue { get; set; }
|
||||
}
|
||||
|
||||
|
||||
//创建一个模型验证的方法
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> PostModelVerify(ModelVerifyCommand modelVerify)
|
||||
{
|
||||
|
||||
return ResponseOutput.Ok(modelVerify);
|
||||
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
public async Task<IResponseOutput> DealIVUSOCTDicomTag(string subjectCode, bool? isUploadOss)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -119,7 +119,10 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
/// <summary>EntityState.Detached的实体 修改 部分字段</summary>
|
||||
public static void EntityModifyPartialFiled<T>(this IRaCISDBContext _dbContext, T waitModifyEntity, Expression<Func<T, T>> updateFactory) where T : Entity
|
||||
{
|
||||
var entityEntry = _dbContext.Entry(waitModifyEntity);
|
||||
//解决重复跟踪问题
|
||||
var tracked = _dbContext.ChangeTracker.Entries<T>().FirstOrDefault(e => e.Entity.Id.Equals(waitModifyEntity.Id));
|
||||
var entityEntry = tracked?? _dbContext.Entry(waitModifyEntity);
|
||||
|
||||
//entityEntry.State = EntityState.Detached;
|
||||
|
||||
var list = ((MemberInitExpression)updateFactory.Body).Bindings.Select(mb => mb.Member.Name)
|
||||
|
|
@ -134,7 +137,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
|
||||
foreach (PropertyInfo prop in list)
|
||||
{
|
||||
_dbContext.Entry(waitModifyEntity).Property(prop.Name).IsModified = true;
|
||||
entityEntry.Property(prop.Name).IsModified = true;
|
||||
|
||||
object value = prop.GetValue(applyObj);
|
||||
prop.SetValue(waitModifyEntity, value);
|
||||
|
|
|
|||
Loading…
Reference in New Issue