Inheritance: Shaolinq.Persistence.Linq.Expressions.SqlExpressionVisitor
		public static object[] CollectValues(Expression expression, Func<SqlConstantPlaceholderExpression, object> transform = null)
		{
			var collector = new SqlConstantPlaceholderValuesCollector();

			collector.Visit(expression);

			if (collector.values.Count == 0)
			{
				return new object[0];
			}

			var retval = new object[collector.maxIndex + 1];

			if (transform == null)
			{
				foreach (var item in collector.values)
				{
					retval[item.Index] = item.ConstantExpression.Value;
				}
			}
			else
			{
				foreach (var item in collector.values)
				{
					retval[item.Index] = transform(item);
				}
			}

			return retval;
		}
Example #2
0
        public static object[] CollectValues(Expression expression, Func <SqlConstantPlaceholderExpression, object> transform = null)
        {
            var collector = new SqlConstantPlaceholderValuesCollector();

            collector.Visit(expression);

            if (collector.values.Count == 0)
            {
                return(new object[0]);
            }

            var retval = new object[collector.maxIndex + 1];

            if (transform == null)
            {
                foreach (var item in collector.values)
                {
                    retval[item.Index] = item.ConstantExpression.Value;
                }
            }
            else
            {
                foreach (var item in collector.values)
                {
                    retval[item.Index] = transform(item);
                }
            }

            return(retval);
        }