From 093d2fc09095d092f6a2010149acd384f4361337 Mon Sep 17 00:00:00 2001 From: Mikhail Kuznetsov Date: Fri, 1 Aug 2025 09:02:01 +1000 Subject: [PATCH] feat(dal): ShortcodesService init --- PARR.DAL/DomainServices/IShortcodesService.cs | 13 +++++++++++++ PARR.DAL/DomainServices/ShortcodesService.cs | 17 +++++++++++++++++ .../TemplateNameGeneratorService.cs | 5 +++-- PARR.DAL/ParrDalInstaller.cs | 1 + 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 PARR.DAL/DomainServices/IShortcodesService.cs create mode 100644 PARR.DAL/DomainServices/ShortcodesService.cs diff --git a/PARR.DAL/DomainServices/IShortcodesService.cs b/PARR.DAL/DomainServices/IShortcodesService.cs new file mode 100644 index 00000000..71beb311 --- /dev/null +++ b/PARR.DAL/DomainServices/IShortcodesService.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PARR.DAL.DomainServices +{ + public interface IShortcodesService + { + Task ApplyShortcodesAsync(string str, Guid unitId, Guid jobId); + } +} diff --git a/PARR.DAL/DomainServices/ShortcodesService.cs b/PARR.DAL/DomainServices/ShortcodesService.cs new file mode 100644 index 00000000..6c83a2aa --- /dev/null +++ b/PARR.DAL/DomainServices/ShortcodesService.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PARR.DAL.DomainServices +{ + internal class ShortcodesService : IShortcodesService + { + public Task ApplyShortcodesAsync(string str, Guid unitId, Guid jobId) + { + //TODO удалить старый в GeneralExtesions, связанные с ним Enum и написать метод. делов... + throw new NotImplementedException(); + } + } +} diff --git a/PARR.DAL/DomainServices/TemplateNameGeneratorService.cs b/PARR.DAL/DomainServices/TemplateNameGeneratorService.cs index 6a28f36e..f6750233 100644 --- a/PARR.DAL/DomainServices/TemplateNameGeneratorService.cs +++ b/PARR.DAL/DomainServices/TemplateNameGeneratorService.cs @@ -29,8 +29,8 @@ namespace PARR.DAL.DomainServices { var nameConstants = settingsFromDb.TemplateNameConstantPartsList; - var job = await jobService.Get().FirstOrDefaultAsync(t => t.Id == jobId); - var unit = await unitService.Get().FirstOrDefaultAsync(t => t.Id == unitId); + var job = await jobService.Get().AsNoTracking().FirstOrDefaultAsync(t => t.Id == jobId); + var unit = await unitService.Get().AsNoTracking().FirstOrDefaultAsync(t => t.Id == unitId); if (job != null && unit != null && job.TemplateNameMask != null) { @@ -67,6 +67,7 @@ namespace PARR.DAL.DomainServices private async Task ReplaceFieldValues(Guid unitId, string resultName, List shortcodesInMask) { var unitWithFields = await unitService.Get() + .AsNoTracking() .Include(u => u.UnitValues) .ThenInclude(uv => uv.Field) .Include(u => u.UnitValues) diff --git a/PARR.DAL/ParrDalInstaller.cs b/PARR.DAL/ParrDalInstaller.cs index 7b35efcf..1f4125cf 100644 --- a/PARR.DAL/ParrDalInstaller.cs +++ b/PARR.DAL/ParrDalInstaller.cs @@ -118,6 +118,7 @@ namespace PARR.DAL #region DomainServces services.AddTransient(); + services.AddTransient(); #endregion }