public AddHookRequestValidatorItem(IHookEntitiesRepository hookEntitiesRepository) { RuleFor(x => x.ServiceId).MustAsync(async(id, cancellation) => { return(await hookEntitiesRepository.GetByServiceIdAsync(id, cancellation) is null); }).WithMessage("Service with id {PropertyValue} already created"); RuleFor(x => x.ServiceUri).Must(uri => Uri.TryCreate(uri, UriKind.Absolute, out _)).WithMessage("Service uri - {PropertyValue} should be valid uri path"); }
public AddHookOperation(ILogService logService, ISettingsService settingsService, IValidationPolicy <AddHookRequest> validationPolicy, IHookEntitiesRepository hookEntitiesRepository) : base( logService, settingsService, validationPolicy) { _hookEntitiesRepository = hookEntitiesRepository; }