public static IFluentContinuation <TViewModel, TPropertyValue> MinLength <TViewModel, TPropertyValue>( this IFluentOperator <TViewModel, TPropertyValue> instance, int minLength) where TViewModel : ViewModelBase where TPropertyValue : IComparable <string>, IEquatable <string> { var implementerInstance = (FluentImplementer <TViewModel, TPropertyValue>)instance; implementerInstance.EnsureContextCurrentPropertyIsNotNull(); if (minLength <= 0) { throw new InvalidOperationException("minLength must be greater than 0"); } var evaluatedValueProvider = new Func <object>(() => { var value = (string)implementerInstance.Context.CurrentProperty.GetValue(); return(value == null ? 0 : value.Length); }); var valueProvider = new Func <object>(() => minLength); implementerInstance.AddToken(ExpressionNode.OpenParenthesis()); implementerInstance.AddToken(ExpressionNode.GreaterThanGeneric(evaluatedValueProvider, valueProvider)); implementerInstance.AddToken(ExpressionNode.Or()); implementerInstance.AddToken(ExpressionNode.EqualToGeneric(evaluatedValueProvider, valueProvider)); implementerInstance.AddToken(ExpressionNode.CloseParenthesis()); return((IFluentContinuation <TViewModel, TPropertyValue>)instance); }