Exemple #1
0
        public static IFluentContinuation <TViewModel, TPropertyValue> BetweenPoperties <TViewModel, TPropertyValue>(
            this IFluentOperator <TViewModel, TPropertyValue> instance,
            Expression <Func <TViewModel, IViewModelProperty> > @from,
            Expression <Func <TViewModel, IViewModelProperty> > to)
            where TViewModel : ViewModelBase
        {
            var implementerInstance = (FluentImplementer <TViewModel, TPropertyValue>)instance;

            implementerInstance.EnsureContextCurrentPropertyIsNotNull();

            implementerInstance.UpdateContext(@from);
            implementerInstance.UpdateContext(to);

            // uses parenthesis to satisfy syntax : IsNot.BetweenValues (...)
            implementerInstance.AddToken(ExpressionNode.OpenParenthesis());
            implementerInstance.AddToken(ExpressionNode.OpenParenthesis());
            implementerInstance.AddToken(ExpressionNode.GreaterThanProperty(implementerInstance.Context.CurrentProperty, @from.Compile()(implementerInstance.ViewModel)));
            implementerInstance.AddToken(ExpressionNode.Or());
            implementerInstance.AddToken(ExpressionNode.EqualToProperty(implementerInstance.Context.CurrentProperty, @from.Compile()(implementerInstance.ViewModel)));
            implementerInstance.AddToken(ExpressionNode.CloseParenthesis());
            implementerInstance.AddToken(ExpressionNode.And());
            implementerInstance.AddToken(ExpressionNode.OpenParenthesis());
            implementerInstance.AddToken(ExpressionNode.LessThanProperty(implementerInstance.Context.CurrentProperty, to.Compile()(implementerInstance.ViewModel)));
            implementerInstance.AddToken(ExpressionNode.Or());
            implementerInstance.AddToken(ExpressionNode.EqualToProperty(implementerInstance.Context.CurrentProperty, to.Compile()(implementerInstance.ViewModel)));
            implementerInstance.AddToken(ExpressionNode.CloseParenthesis());
            implementerInstance.AddToken(ExpressionNode.CloseParenthesis());

            return((IFluentContinuation <TViewModel, TPropertyValue>)instance);
        }
Exemple #2
0
        public static IFluentContinuation <TViewModel, TPropertyValue> GreaterThan <TViewModel, TPropertyValue>(
            this IFluentOperator <TViewModel, TPropertyValue> instance, Expression <Func <TViewModel, IViewModelProperty> > propertyExpression)
            where TViewModel : ViewModelBase
            where TPropertyValue : IComparable
        {
            var implementerInstance = (FluentImplementer <TViewModel, TPropertyValue>)instance;

            implementerInstance.EnsureContextCurrentPropertyIsNotNull();

            implementerInstance.UpdateContext(propertyExpression);

            implementerInstance.AddToken(ExpressionNode.GreaterThanProperty(implementerInstance.Context.CurrentProperty, propertyExpression.Compile()(implementerInstance.ViewModel)));
            return((IFluentContinuation <TViewModel, TPropertyValue>)instance);
        }