public async Task <Unit> Handle(SaveSettingCommand request, CancellationToken cancellationToken) { var property = settings.GetType().GetProperty(request.Property); property.SetValue(settings, request.Value); await mediator.Send(new SaveSettingsCommand(settings)); return(Unit.Value); }
public async Task <Unit> Handle(SaveSettingCommand request, CancellationToken cancellationToken) { var property = settings.GetType().GetProperty(request.Property); var value = property.GetValue(settings); if (value != null && request.Value != null && value.Equals(request.Value)) { return(Unit.Value); } property.SetValue(settings, request.Value); await mediator.Send(new SaveSettingsCommand(settings)); return(Unit.Value); }