diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index b92dc6a5f..5d3df0cc5 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -9497,6 +9497,16 @@ 评估原因 + + + 数值类型 + + + + + 自定义单位 + + 问题类型 @@ -9642,6 +9652,11 @@ 数值类型 + + + 自定义单位 + + 类型 @@ -9782,6 +9797,16 @@ 字典code + + + 自定义单位 + + + + + 数值类型 + + 是否存在疾病 @@ -10697,6 +10722,16 @@ 问题英文名称 + + + 数值类型 + + + + + 自定义单位 + + 排序 diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index 0a2ffbadc..8ecfcbd5f 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -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 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 PostModelVerify(ModelVerifyCommand modelVerify) + { + + return ResponseOutput.Ok(modelVerify); + + } + [AllowAnonymous] public async Task DealIVUSOCTDicomTag(string subjectCode, bool? isUploadOss) { @@ -102,7 +153,7 @@ namespace IRaCIS.Core.Application.Service { Console.WriteLine(item.Path); - await using var stream = await _IOSSService.GetStreamFromOSSAsync(item.Path); + await using var stream = await _IOSSService.GetStreamFromOSSAsync(item.Path); var dicomFile = DicomFile.Open(stream, FileReadOption.ReadLargeOnDemand); diff --git a/IRaCIS.Core.Infra.EFCore/Repository/IRaCISContextExtension.cs b/IRaCIS.Core.Infra.EFCore/Repository/IRaCISContextExtension.cs index 71fb563e1..ebd59fe2a 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/IRaCISContextExtension.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/IRaCISContextExtension.cs @@ -119,7 +119,10 @@ namespace IRaCIS.Core.Infra.EFCore /// EntityState.Detached的实体 修改 部分字段 public static void EntityModifyPartialFiled(this IRaCISDBContext _dbContext, T waitModifyEntity, Expression> updateFactory) where T : Entity { - var entityEntry = _dbContext.Entry(waitModifyEntity); + //解决重复跟踪问题 + var tracked = _dbContext.ChangeTracker.Entries().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);