Beispiel #1
0
        public static IValueOf getStrategy(Expression expr)
        {
            IValueOf strategy = ValueOfConst.clone();

            if (expr is MemberExpression)
            {
                MemberExpression member = (MemberExpression)expr;

                if (member.Expression is MemberExpression) // expr là một property trong object
                {
                    strategy = ValueOfObject.clone();
                }
                else if (member.Expression is ConstantExpression) // expr là một biến
                {
                    strategy = ValueOfVariable.clone();
                }
                else
                {
                    strategy = ValueOfDatetime.clone();
                }
            }
            else if (expr is MethodCallExpression) // expr là 1 fuction
            {
                strategy = ValueOfMethod.clone();
            }
            else if (expr is UnaryExpression)
            {
                strategy = ValueOfUnary.clone();
            }
            return(strategy);
        }
Beispiel #2
0
 public static ValueOfMethod clone()
 {
     if (value == null)
     {
         value = new ValueOfMethod();
     }
     return(value);
 }