using System; using AutoMapper; using EnvelopeGenerator.Domain.Interfaces.Auditing; namespace EnvelopeGenerator.Application.Common.Extensions; /// /// Extension methods for applying auditing timestamps during AutoMapper mappings. /// public static class AutoMapperAuditingExtensions { /// /// Maps to the current UTC time. /// public static IMappingExpression MapAddedWhen(this IMappingExpression expression) where TDestination : IHasAddedWhen => expression.ForMember(dest => dest.AddedWhen, opt => opt.MapFrom(_ => DateTime.UtcNow)); /// /// Maps to the current UTC time. /// public static IMappingExpression MapChangedWhen(this IMappingExpression expression) where TDestination : IHasChangedWhen => expression.ForMember(dest => dest.ChangedWhen, opt => opt.MapFrom(_ => DateTime.UtcNow)); }