title: How to access propertyvalue in FluentModelValidator
body: <p>How can I access property value in Fluent Model Validator?. Below is the 
  validator class for ModelA. ModelA has a bool property named isValid. 
  How can I access the boolean value within this class?.</p>
  
  <pre><code> public class ModelAValidator :  
   AbstractValidator&lt;ModelA&gt;
  
  {
  
      public ModelAValidator()
  
      {
         var regexPatterns = new RegExPatterns();
         RuleFor(x =&gt; x.FirstName)
            .RequiredForBeneficiaryWhen(x =&gt; x.IsBeneficiaryValid)
            .WithLocalizedMessage(ResourceAreas.Messages.Message_PersonalDetails_1001_firstname)
  
  
       RuleFor(x =&gt; x.FirstLastName).
              RequiredForBeneficiaryWhen(x =&gt; x.IsBeneficiaryValid)
              .WithLocalizedMessage(ResourceAreas.Messages.Message_PersonalDetails_1001_firstname)
  
      }
  
  }
  </code></pre>
  
  <p>ExtensionMethod-</p>
  
  <pre><code>public static IRuleBuilderOptions&lt;T, TProperty&gt;   
          RequiredForBeneficiaryWhen&lt;T, TProperty&gt;(
          this IRuleBuilder&lt;T, TProperty&gt; ruleBuilder,     
          Expression&lt;Func&lt;T, bool&gt;&gt; conditionalProperty)
  {
  
          var validationrule = new UnobtrusiveValidationRule()
          {
              ValidationType = "mvfbenefreq"
          };
  
          return
              ruleBuilder.SetValidator(new  
             BeneficiaryRequiredValidation&lt;T&gt;(conditionalProperty, 
          false, validationrule));
  }
  </code></pre>
  
  <p>Property Validator -</p>
  
  <pre><code>public class BeneficiaryRequiredValidation&lt;T&gt; : PropertyValidator, IClientValidatable
  {
      public object CompareTo { get; private set; }
      public UnobtrusiveValidationRule ClientValidationRule { get; set; }
      private readonly Expression&lt;Func&lt;T, bool&gt;&gt; _conditonalExpression;
      private readonly bool _conditionalValue;
  
  
      public BeneficiaryRequiredValidation(Expression&lt;Func&lt;T, bool&gt;&gt; compareExpression, bool conditionalValue , UnobtrusiveValidationRule clientvalidationrule)
          : base(FluentValidation.Resources.Messages.lessthan_error)
      {
          ClientValidationRule = clientvalidationrule;
          _conditonalExpression = compareExpression;
          _conditionalValue = conditionalValue;
      }
  
      protected override bool IsValid(PropertyValidatorContext context)
      {
          return true;
  
      }
  
      [ExcludeFromCodeCoverage]
      public IEnumerable&lt;ModelClientValidationRule&gt; GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
      {
          var formatter = new MessageFormatter().AppendPropertyName(metadata.PropertyName);
          var message = formatter.BuildMessage(ErrorMessageSource.GetString());
  
          var rule = new ModelClientValidationRule
          {
              ErrorMessage = message,
              ValidationType = ClientValidationRule.ValidationType
          };
  
          if (ClientValidationRule.Parameterlist != null)
          {
              foreach (var entry in ClientValidationRule.Parameterlist)
              {
                  rule.ValidationParameters.Add(entry.Key, entry.Value);
              }
          }
          yield return rule;
      }
  }
  </code></pre>
  
  <p>Thank you</p>