using Microsoft.ApplicationInsights; namespace PlanTempus.Components.Users.Create; public class CreateUserHandlerDecorator : ICommandHandler { private readonly ICommandHandler _decoratedHandler; private readonly TelemetryClient _telemetryClient; public CreateUserHandlerDecorator( ICommandHandler decoratedHandler, TelemetryClient telemetryClient) { _decoratedHandler = decoratedHandler; _telemetryClient = telemetryClient; } public async Task Handle(CreateUserCommand command) { _telemetryClient.TrackTrace($"Before handling {nameof(CreateUserCommand)}"); var result = await _decoratedHandler.Handle(command); _telemetryClient.TrackTrace($"After handling {nameof(CreateUserCommand)}"); return result; } }