示例#1
0
        public static int Find(Expression expression)
        {
            var finder = new SqlConstantPlaceholderMaxIndexFinder();

            finder.Visit(expression);

            return(finder.maxIndex);
        }
		public static int Find(Expression expression)
		{
			var finder = new SqlConstantPlaceholderMaxIndexFinder();

			finder.Visit(expression);

			return finder.maxIndex;
		}
示例#3
0
        internal static Expression Bind(DataAccessModel dataAccessModel, SqlDataTypeProvider sqlDataTypeProvider, Expression expression)
        {
            var placeholderCount = SqlConstantPlaceholderMaxIndexFinder.Find(expression) + 1;

            expression = Evaluator.PartialEval(expression, ref placeholderCount);
            expression = QueryBinder.Bind(dataAccessModel, expression, ref placeholderCount);
            expression = SqlEnumTypeNormalizer.Normalize(expression, sqlDataTypeProvider.GetTypeForEnums());
            expression = Evaluator.PartialEval(expression, ref placeholderCount);
            expression = SqlNullComparisonCoalescer.Coalesce(expression);
            expression = SqlTupleOrAnonymousTypeComparisonExpander.Expand(expression);
            expression = SqlObjectOperandComparisonExpander.Expand(expression);
            expression = SqlRedundantFunctionCallRemover.Remove(expression);

            return(expression);
        }
示例#4
0
            internal static Expression Eval(HashSet <Expression> candidates, Expression expression, ref int placeholderCount)
            {
                if (candidates.Count == 0)
                {
                    return(expression);
                }

                var i = placeholderCount >= 0 ? placeholderCount : SqlConstantPlaceholderMaxIndexFinder.Find(expression) + 1;

                var evaluator = new SubtreeEvaluator(candidates)
                {
                    index = i
                };

                return(evaluator.Visit(expression));
            }