예제 #1
0
        protected Expression Build(object data)
        {
            var type = data.GetType();

            if (type == typeof(Dictionary <string, IEnumerable <object> >))
            {
                Console.WriteLine("Found dictionary");
                var dataObject = (Dictionary <string, IEnumerable <object> >)data;
                var builder    = GetBuilder(dataObject);
                return(builder(dataObject));
            }
            if (type == typeof(string) || type == typeof(int) || type == typeof(decimal) || type == typeof(bool) || type == typeof(float) || type == typeof(double))
            {
                if (type == typeof(string))
                {
                    var param = ParameterExpressions.SingleOrDefault(p => p.Name == (string)data);
                    if (param != null)
                    {
                        return(param);
                    }
                }
                Console.WriteLine($"Found {type}");
                return(BuildConstant(data));
            }

            Console.WriteLine($"Couldn't find {type}");

            return(null);
        }
예제 #2
0
        public ParameterExpression AddParameter <TEntity>(string name)
        {
            ParameterExpression parameterExpression = ExpressionFactory.Parameter <TEntity>(name);

            ParameterExpressions.Add(parameterExpression);

            return(parameterExpression);
        }
예제 #3
0
 /// <summary>
 /// Adds a parameters to the method invocation.
 /// </summary>
 /// <param name="parameterExpression">is the expression to add</param>
 /// <returns>stream</returns>
 public MethodInvocationStream AddParameter(Expression parameterExpression)
 {
     ParameterExpressions.Add(parameterExpression);
     return(this);
 }