修改发布版本
continuous-integration/drone/push Build is running Details

IRC_NewDev
hang 2024-09-29 13:57:41 +08:00
parent e4a36f4689
commit 03702477d6
5 changed files with 37 additions and 3 deletions

View File

@ -60,7 +60,7 @@ public class SystemEmailSendConfig
public string CompanyShortNameCN { get; set; } = string.Empty;
public string IsEnv_US { get; set; }
public bool IsEnv_US { get; set; }
}
public class SystemEmailSendConfigView

View File

@ -3,6 +3,7 @@
using AutoMapper;
using IRaCIS.Core.Domain;
using MassTransit;
using Microsoft.EntityFrameworkCore;
namespace IRaCIS.Core.Application.MassTransit.Consumer;
@ -22,7 +23,15 @@ public class AddSubjectTriggerConsumer(IRepository<SubjectVisit> _subjectVisitRe
{
public async Task Consume(ConsumeContext<AddSubjectTriggerCommand> context)
{
var addSubjectEvent= context.Message;
var addSubjectEvent = context.Message;
{
Console.WriteLine(_visitStageRepository._dbContext.GetHashCode());
Console.WriteLine("两个 DbContext 不是同一个实例");
}
//添加受试者的时候,获取访视计划列表,添加到受试者访视表。
var visitPlanList = await _visitStageRepository.Where(t => t.TrialId == addSubjectEvent.TrialId && t.IsConfirmed).ToListAsync();

View File

@ -14,7 +14,7 @@ namespace IRaCIS.Core.Application.ViewModel
public Guid UpdateUserId { get; set; }
public DateTime UpdateTime { get; set; }
public string IsEnv_US { get; set; }
public bool IsEnv_US { get; set; }
}
///<summary>PublishLogQuery 列表查询参数模型</summary>

View File

@ -6,6 +6,7 @@ using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Infrastructure.Encryption;
using IRaCIS.Core.Infrastructure.NewtonsoftJson;
@ -18,8 +19,11 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using MiniExcelLibs;
using NPOI.SS.Formula.Functions;
using NPOI.XWPF.UserModel;
using System.Runtime.InteropServices;
using System.Text;
using Tea;
namespace IRaCIS.Core.Application.Service
@ -121,12 +125,32 @@ namespace IRaCIS.Core.Application.Service
}
//My project is a monolithic project,And the efcore context repository is scoped registered.
public async Task<IResponseOutput> TestMasstransitMeditor([FromServices] IMediator _mediator, [FromServices] IRepository<TestLength> _testLengthRepository)
{
var dbContext = _testLengthRepository._dbContext;
var dbContext2 = _trialRepository._dbContext;
if (ReferenceEquals(dbContext, dbContext2))
{
Console.WriteLine("两个 DbContext 是同一个实例");
Console.WriteLine(dbContext.GetHashCode());
Console.WriteLine(dbContext2.GetHashCode());
}
// add 1 recored
await _testLengthRepository.AddAsync(new TestLength() { Name = "xxxx" });
// The consumer method will inject the repository and add 3 pieces of data, but the savechanges method of the repository will not be called
await _mediator.Send(new AddSubjectTriggerCommand { SubjectId = Guid.Empty });
// this will save 1 record not 4 record ,Why is the dbcontext different? Can it be in the same transaction?
await _testLengthRepository.SaveChangesAsync();
return ResponseOutput.Ok();

View File

@ -12,4 +12,5 @@ public class AddSubjectTriggerCommand : DomainCommand
public Guid TrialId { get; set; }
public Guid TrialSiteId { get; set; }
}