diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs index c24d1717f..26577be2f 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs @@ -66,12 +66,14 @@ namespace IRaCIS.Application.Services svlist.ForEach(t => { + t.SubjectId= mapedSubject.Id, t.TrialId = subjectCommand.TrialId; t.SiteId = subjectCommand.SiteId; t.IsEnrollmentConfirm = t.IsBaseLine ? IsEnrollementQualificationConfirm : false; }); - mapedSubject.SubjectVisitList = svlist; + + await _subjectVisitRepository.AddRangeAsync(svlist); } else //update { @@ -239,7 +241,7 @@ namespace IRaCIS.Application.Services } var isSuccess = await _subjectRepository.BatchDeleteAsync(u => u.Id == id); - await _subjectVisitRepository.BatchDeleteAsync(u => u.SubjectId == id); + await _subjectVisitRepository.TrackingBatchDeleteAsync(u => u.SubjectId == id); var subvisit = await _subjectVisitRepository.Where(x => x.SubjectId == id).ToListAsync(); diff --git a/IRaCIS.Core.Application/Triggers/AddVisitPlanTrigger.cs b/IRaCIS.Core.Application/Triggers/AddVisitPlanTrigger.cs index 7cb2ef195..3ada949c7 100644 --- a/IRaCIS.Core.Application/Triggers/AddVisitPlanTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/AddVisitPlanTrigger.cs @@ -48,6 +48,8 @@ namespace IRaCIS.Core.Application.Triggers await _subjectVisitRepository.AddAsync(svItem); } + + await _subjectVisitRepository.SaveChangesAsync(); } } diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs index 79a1e897a..758252f35 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs @@ -225,6 +225,8 @@ namespace IRaCIS.Core.Infra.EFCore } + + /// EF跟踪方式 删除 public async Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default) {