/// <summary> /// Initializes a new instance of the <see cref="NotEqualToValidator"/> class. /// </summary> /// <param name="valueToCompare">The value to compare.</param> /// <param name="comparer">The comparer.</param> /// <exception cref="System.ArgumentNullException">valueToCompare</exception> public NotEqualToValidator(object valueToCompare, IEqualityComparer comparer = null) { if (valueToCompare == null) { throw new ArgumentNullException("valueToCompare"); } m_EqualToValidator = new EqualToValidator(valueToCompare, comparer); m_ValidatorProperties = new ValidatorProperties { { Constants.ValidationMessageParameterNames.VALUE_TO_COMPARE, ValueToCompare } }; }
/// <summary> /// Determines whether the specified property value for the entity is valid. /// </summary> /// <param name="entity">The entity.</param> /// <param name="propertyValue">The property value.</param> /// <returns><c>true</c> if the specified property value for the entity is valid, otherwise <c>false</c></returns> public bool IsValid(object entity, object propertyValue) { return(EqualToValidator.IsValid(propertyValue, GetValueToCompare(entity), m_Comparer)); }