コード例 #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);
        }
コード例 #2
0
ファイル: ValueOfUnary.cs プロジェクト: tumeotu/ORM
 public static ValueOfUnary clone()
 {
     if (value == null)
     {
         value = new ValueOfUnary();
     }
     return(value);
 }