public static IValitRule <TObject, TProperty> WithMessageKey <TObject, TProperty, TKey>(this IValitRule <TObject, TProperty> rule, TKey messageKey) where TObject : class
        {
            rule.ThrowIfNull(ValitExceptionMessages.NullRule);

            var accessor        = rule.GetAccessor();
            var messageProvider = accessor.GetMessageProvider <TKey>();

            var error = ValitRuleError.CreateForMessage(() => messageProvider.GetByKey(messageKey));

            accessor.AddError(error);
            return(rule);
        }
        internal static IValitRule <TObject, TProperty> WithMessage <TObject, TProperty>(this IValitRule <TObject, TProperty> rule, string message, bool isDefault) where TObject : class
        {
            rule.ThrowIfNull(ValitExceptionMessages.NullRule);
            message.ThrowIfNull();

            var accessor = rule.GetAccessor();

            var error = ValitRuleError.CreateForMessage(() => message, isDefault);

            accessor.AddError(error);
            return(rule);
        }
        public static IValitRule <TObject, TProperty> WithMessage <TObject, TProperty>(
            this IValitRule <TObject, TProperty> rule, Func <string> messageFunc) where TObject : class
        {
            rule.ThrowIfNull(ValitExceptionMessages.NullRule);
            messageFunc.ThrowIfNull();

            var accessor = rule.GetAccessor();

            var error = ValitRuleError.CreateForMessage(messageFunc);

            accessor.AddError(error);
            return(rule);
        }