Refactor EnvelopeType handling and introduce caching

Updated `EnvelopeDto` to use `EnvelopeTypeDefaultsDto` for the `Defaults` property, decoupling domain entities from external layers.

Refactored `IEnvelopeTypeRepository`, `IEnvelopeTypeService`, and `EnvelopeTypeService` to use `EnvelopeType` as the identifier type instead of `int`, improving domain specificity and consistency.

Introduced caching in `EnvelopeTypeService` with a static `CacheKey` and `IMemoryCache` dependency for performance optimization.

Aligned `EnvelopeTypeRepository` with the updated identifier type and repository interface.
This commit is contained in:
2026-11-13 12:59:48 +01:00
parent 9d4806bef7
commit abd3c23f8c
5 changed files with 9 additions and 5 deletions

View File

@@ -129,7 +129,7 @@ public record EnvelopeDto : IEnvelope
/// <summary>
///
/// </summary>
public EnvelopeTypeDefaults? Defaults { get; set; }
public EnvelopeTypeDefaultsDto? Defaults { get; set; }
/// <summary>
///

View File

@@ -1,4 +1,5 @@
using DigitalData.Core.Abstraction.Application.Repository;
using EnvelopeGenerator.Domain.Constants;
using EnvelopeGenerator.Domain.Entities;
namespace EnvelopeGenerator.Application.Common.Interfaces.Repositories;
@@ -7,6 +8,6 @@ namespace EnvelopeGenerator.Application.Common.Interfaces.Repositories;
///
/// </summary>
[Obsolete("Use IRepository")]
public interface IEnvelopeTypeRepository : ICRUDRepository<EnvelopeTypeDefaults, int>
public interface IEnvelopeTypeRepository : ICRUDRepository<EnvelopeTypeDefaults, EnvelopeType>
{
}

View File

@@ -1,5 +1,6 @@
using DigitalData.Core.Abstraction.Application;
using EnvelopeGenerator.Application.Common.Dto;
using EnvelopeGenerator.Domain.Constants;
using EnvelopeGenerator.Domain.Entities;
namespace EnvelopeGenerator.Application.Common.Interfaces.Services;
@@ -8,6 +9,6 @@ namespace EnvelopeGenerator.Application.Common.Interfaces.Services;
///
/// </summary>
[Obsolete("Use MediatR")]
public interface IEnvelopeTypeService : IBasicCRUDService<EnvelopeTypeDefaultsDto, EnvelopeTypeDefaults, int>
public interface IEnvelopeTypeService : IBasicCRUDService<EnvelopeTypeDefaultsDto, EnvelopeTypeDefaults, EnvelopeType>
{
}