From 1fb1b3d563dba47db98c8d7165ed124f087d7c92 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 6 Dec 2023 09:57:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BB=E7=94=9F=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/Progranm.cs | 13 ++++++++++++- .../Service/Doctor/ResearchPublicationService.cs | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.API/Progranm.cs b/IRaCIS.Core.API/Progranm.cs index be89b76e3..af047ad5f 100644 --- a/IRaCIS.Core.API/Progranm.cs +++ b/IRaCIS.Core.API/Progranm.cs @@ -43,7 +43,6 @@ if (string.IsNullOrWhiteSpace(enviromentName)) ? args[index + 1] : "Development"; } - #endregion var builder = WebApplication.CreateBuilder(new WebApplicationOptions @@ -51,11 +50,23 @@ var builder = WebApplication.CreateBuilder(new WebApplicationOptions EnvironmentName = enviromentName }); +#region 兼容windows 服务命令行的方式 + +var urlsIndex = Array.IndexOf(args, "--urls"); +if (urlsIndex > -1) +{ + builder.WebHost.UseUrls(args[urlsIndex + 1]); +} +// +#endregion + #region 主机配置 NewId.SetProcessIdProvider(new CurrentProcessIdProvider()); + + builder.Host .ConfigureAppConfiguration((hostContext, config) => { diff --git a/IRaCIS.Core.Application/Service/Doctor/ResearchPublicationService.cs b/IRaCIS.Core.Application/Service/Doctor/ResearchPublicationService.cs index 1c17ceebe..8749571be 100644 --- a/IRaCIS.Core.Application/Service/Doctor/ResearchPublicationService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/ResearchPublicationService.cs @@ -23,9 +23,9 @@ namespace IRaCIS.Application.Services public async Task GetResearchPublication(Guid doctorId) { var doctorScientificResearchInfo = await researchPublicationRepository.Where(o => o.DoctorId == doctorId) - .ProjectTo(_mapper.ConfigurationProvider).FirstNotNullAsync(); + .ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); - return doctorScientificResearchInfo; + return doctorScientificResearchInfo!; }