Пример #1
0
        public static FluentValidationConfig UseFluentValidation(
            this EndpointConfiguration endpoint,
            ValidatorLifecycle lifecycle = ValidatorLifecycle.Endpoint,
            bool incoming = true,
            bool outgoing = true)
        {
            Guard.AgainstNull(endpoint, nameof(endpoint));
            var recoverability = endpoint.Recoverability();

            recoverability.AddUnrecoverableException <MessageValidationException>();
            FluentValidationConfig config = new(endpoint, lifecycle);
            var pipeline = endpoint.Pipeline;

            if (incoming)
            {
                pipeline.Register(new IncomingValidationStep(config));
            }
            if (outgoing)
            {
                pipeline.Register(new OutgoingValidationStep(config));
            }
            return(config);
        }