From 9b25cea893aee4f3b01c43833776bbf37cac7c6b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 13 Oct 2023 11:18:26 +0800 Subject: [PATCH] =?UTF-8?q?EntityFrameworkCore.Projectables=20=20=E5=8C=85?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20=E5=AF=BC=E8=87=B4=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs | 2 +- IRaCIS.Core.Application/IRaCIS.Core.Application.csproj | 1 - IRaCIS.Core.Application/TestService.cs | 3 +++ IRaCIS.Core.Domain/Allocation/VisitTask.cs | 3 +-- IRaCIS.Core.Domain/Common/Dictionary.cs | 4 ---- IRaCIS.Core.Domain/Dcotor/Doctor.cs | 3 +-- IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj | 4 ---- IRaCIS.Core.Domain/Management/User.cs | 4 ++-- .../IRaCIS.Core.Infrastructure.csproj | 6 +++--- 9 files changed, 11 insertions(+), 19 deletions(-) diff --git a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs index 3a7df5742..c3d3700d1 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs @@ -27,7 +27,7 @@ namespace IRaCIS.Core.API options.AddInterceptors(new QueryWithNoLockDbCommandInterceptor()); - options.UseProjectables(); + //options.UseProjectables(); //options.AddInterceptors(new AuditingInterceptor(configuration.GetSection("ConnectionStrings:RemoteNew").Value)); diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj index aa9a82bba..5e1574265 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj @@ -64,7 +64,6 @@ - diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index 46153bca6..158e1a40b 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -63,6 +63,9 @@ namespace IRaCIS.Application.Services [AllowAnonymous] public async Task TestDistributedLock( ) { + + _repository.Where().Select(t => t.FullName).FirstOrDefault(); + Console.WriteLine($"我进来了当前值是:" + IntValue); _logger.LogWarning($"我进来了当前值是:" + IntValue); diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index 73daba8ce..e0568cebd 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -9,7 +9,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Collections.Generic; using System.Linq; -using EntityFrameworkCore.Projectables; namespace IRaCIS.Core.Domain.Models { @@ -324,7 +323,7 @@ namespace IRaCIS.Core.Domain.Models public Guid? BeforeConvertedTaskId { get; set; } - [Projectable] + [NotMapped] [JsonIgnore] public bool IsConvertedTask => BeforeConvertedTaskId != null || IsHistoryConvertedTask|| Subject.SubjectVisitTaskList.Where(t => t.TrialReadingCriterionId == TrialReadingCriterionId && t.DoctorUserId == DoctorUserId && t.BeforeConvertedTaskId != null diff --git a/IRaCIS.Core.Domain/Common/Dictionary.cs b/IRaCIS.Core.Domain/Common/Dictionary.cs index f178c6154..b0596c510 100644 --- a/IRaCIS.Core.Domain/Common/Dictionary.cs +++ b/IRaCIS.Core.Domain/Common/Dictionary.cs @@ -1,4 +1,3 @@ -using EntityFrameworkCore.Projectables; using IRaCIS.Core.Domain.Share; using System; using System.Collections.Generic; @@ -60,9 +59,6 @@ namespace IRaCIS.Core.Domain.Models - [Projectable] - public string TranslateValue( string value, string valueCN,bool isCN) => isCN?valueCN:value; - } } diff --git a/IRaCIS.Core.Domain/Dcotor/Doctor.cs b/IRaCIS.Core.Domain/Dcotor/Doctor.cs index fcfdcfff7..09b034b9e 100644 --- a/IRaCIS.Core.Domain/Dcotor/Doctor.cs +++ b/IRaCIS.Core.Domain/Dcotor/Doctor.cs @@ -1,4 +1,3 @@ -using EntityFrameworkCore.Projectables; using IRaCIS.Core.Domain.Share; using System; using System.Collections.Generic; @@ -51,7 +50,7 @@ namespace IRaCIS.Core.Domain.Models [StringLength(100)] public string LastName { get; set; } = string.Empty; - [Projectable] + [NotMapped] public string FullName => LastName + " / " + FirstName; public int Sex { get; set; } diff --git a/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj b/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj index f9c01aaf3..9213bafcd 100644 --- a/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj +++ b/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj @@ -8,10 +8,6 @@ ..\bin - - - - diff --git a/IRaCIS.Core.Domain/Management/User.cs b/IRaCIS.Core.Domain/Management/User.cs index ade0229e1..946eb6683 100644 --- a/IRaCIS.Core.Domain/Management/User.cs +++ b/IRaCIS.Core.Domain/Management/User.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using EntityFrameworkCore.Projectables; using IRaCIS.Core.Domain.Share; namespace IRaCIS.Core.Domain.Models @@ -93,7 +92,8 @@ namespace IRaCIS.Core.Domain.Models /// public bool AutoCutNextTask { get; set; } = false; - [Projectable] public string FullName => LastName + " / " + FirstName; + [NotMapped] + public string FullName => LastName + " / " + FirstName; //[Projectable] public string FullName => $"{LastName} / {FirstName}"; } diff --git a/IRaCIS.Core.Infrastructure/IRaCIS.Core.Infrastructure.csproj b/IRaCIS.Core.Infrastructure/IRaCIS.Core.Infrastructure.csproj index 16fa0af42..66854efcc 100644 --- a/IRaCIS.Core.Infrastructure/IRaCIS.Core.Infrastructure.csproj +++ b/IRaCIS.Core.Infrastructure/IRaCIS.Core.Infrastructure.csproj @@ -12,10 +12,10 @@ - - + + - +