public PropertyInfoValueCollection Clone()
        {
            PropertyInfoValueCollection propertyInfoValueCollection = new PropertyInfoValueCollection();

            foreach (var kvp in this.PropertyValues)
            {
                propertyInfoValueCollection.AddPropertyValue(kvp.Key, kvp.Value);
            }

            return propertyInfoValueCollection;
        }
Beispiel #2
0
        public PropertyInfoValueCollection Clone()
        {
            PropertyInfoValueCollection propertyInfoValueCollection = new PropertyInfoValueCollection();

            foreach (var kvp in this.PropertyValues)
            {
                propertyInfoValueCollection.AddPropertyValue(kvp.Key, kvp.Value);
            }

            return(propertyInfoValueCollection);
        }
        public ExpressionBuilder Where(PropertyInfoValueCollection propertyInfoValueCollection, bool useInnerDateTimeDate)
        {
            ParameterExpression parameterExpression = Expression.Parameter(_currentQueryableType, "w");

            Expression currentExpression = null;

            foreach (var kvp in propertyInfoValueCollection.PropertyValues)
            {
                Expression left  = LambdaExpression.Property(parameterExpression, kvp.Key);
                Expression right = Expression.Constant(kvp.Value, kvp.Key.PropertyType);

                if (useInnerDateTimeDate && kvp.Key.PropertyType == typeof(DateTime))
                {
                    left  = InnerDateTimeDateExpression(left);
                    right = InnerDateTimeDateExpression(right);
                }

                Expression filter = Expression.Equal(left, right);

                if (currentExpression == null)
                {
                    currentExpression = filter;
                }
                else
                {
                    currentExpression = Expression.And(currentExpression, filter);
                }
            }

            LambdaExpression lambdaExpression = Expression.Lambda(currentExpression, parameterExpression);

            MethodCallExpression methodCallExpression = Expression.Call
                                                        (
                typeof(Queryable),
                "Where",
                new Type[] { _currentQueryableType, },
                _currentExpression,
                Expression.Quote(lambdaExpression)
                                                        );

            _currentExpression = methodCallExpression;

            return(this);
        }
Beispiel #4
0
        public ExpressionBuilder Where(PropertyInfoValueCollection propertyInfoValueCollection, bool useInnerDateTimeDate)
        {
            ParameterExpression parameterExpression = Expression.Parameter(_currentQueryableType, "w");

            Expression currentExpression = null;
            foreach (var kvp in propertyInfoValueCollection.PropertyValues)
            {
                Expression left = LambdaExpression.Property(parameterExpression, kvp.Key);                
                Expression right = Expression.Constant(kvp.Value, kvp.Key.PropertyType);

                if (useInnerDateTimeDate && kvp.Key.PropertyType == typeof(DateTime))
                {
                    left = InnerDateTimeDateExpression(left);
                    right = InnerDateTimeDateExpression(right);
                }

                Expression filter = Expression.Equal(left, right);

                if (currentExpression == null)
                {
                    currentExpression = filter;
                }
                else
                {
                    currentExpression = Expression.And(currentExpression, filter);
                }
            }

            LambdaExpression lambdaExpression = Expression.Lambda(currentExpression, parameterExpression);

            MethodCallExpression methodCallExpression = Expression.Call
            (
                typeof(Queryable),
                "Where",
                new Type[] { _currentQueryableType, },
                _currentExpression,
                Expression.Quote(lambdaExpression)
            );

            _currentExpression = methodCallExpression;

            return this;
        }
 public ExpressionBuilder Where(PropertyInfoValueCollection propertyInfoValueCollection)
 {
     return(Where(propertyInfoValueCollection, false));
 }
Beispiel #6
0
 public ExpressionBuilder Where(PropertyInfoValueCollection propertyInfoValueCollection)
 {
     return Where(propertyInfoValueCollection, false);
 }