/// <summary> /// Asserts that the specified property was not bound. /// </summary> /// <typeparam name="K"></typeparam> /// <param name="property">The property.</param> public void AssertWasNotBound <K>(Expression <Func <T, K> > property) { if (WasNotBoundTo(property)) { return; } throw new ValidationException( string.Format( "The binding {0} on {1} was found, but should not exist.", ExpressionHelper.GetPathFromExpression(property), typeof(T).Name ) ); }
/// <summary> /// Determines if the property was bound. /// </summary> /// <typeparam name="K"></typeparam> /// <param name="property">The property.</param> /// <returns></returns> public bool WasBoundTo <K>(Expression <Func <T, K> > property) { var propertyPath = ExpressionHelper.GetPathFromExpression(property); return(WasBoundTo(propertyPath)); }
/// <summary> /// Add a type hint for a property path, specifying the actual type returned /// by the last property of the property path chain /// </summary> /// <typeparam name="K"></typeparam> /// <param name="property">The property</param> /// <param name="hint">The Type actually returned.</param> /// <returns></returns> public BindingValidator <T> WithHint <K>(Expression <Func <T, K> > property, Type hint) { WithHint(ExpressionHelper.GetPathFromExpression(property), hint); return(this); }