示例#1
0
            public override IsExpressionResult IsExpression(Expression expression, int level, RequestFor requestFlag)
            {
                if (level != 0)
                {
                    var levelExpression = expression.GetLevelExpression(Builder.MappingSchema, level);

                    if (levelExpression.NodeType == ExpressionType.MemberAccess)
                    {
                        var ma = (MemberExpression)levelExpression;

                        if (ma.Member.Name == "Key" && ma.Member.DeclaringType == _groupingType)
                        {
                            return(ReferenceEquals(levelExpression, expression) ?
                                   _key.IsExpression(null, 0, requestFlag) :
                                   _key.IsExpression(expression, level + 1, requestFlag));
                        }
                    }
                    else if (levelExpression.NodeType == ExpressionType.Call)
                    {
                        if (requestFlag == RequestFor.Expression)
                        {
                            return(IsExpressionResult.True);
                        }
                    }
                }

                return(IsExpressionResult.False);
            }
示例#2
0
            public override bool IsExpression(Expression expression, int level, RequestFor requestFlag)
            {
                //switch (requestFlag)
                //{
                //	case RequestFor.Object: return expression == null;
                //}

                if (level != 0)
                {
                    var levelExpression = expression.GetLevelExpression(level);

                    if (levelExpression.NodeType == ExpressionType.MemberAccess)
                    {
                        var ma = (MemberExpression)levelExpression;

                        if (ma.Member.Name == "Key" && ma.Member.DeclaringType == _groupingType)
                        {
                            return(levelExpression == expression?
                                   _key.IsExpression(null, 0, requestFlag) :
                                       _key.IsExpression(expression, level + 1, requestFlag));
                        }

                        //return Sequence.BuildExpression(expression, level);
                    }
                }

                return(false);
            }
示例#3
0
            public override IsExpressionResult IsExpression(Expression expression, int level, RequestFor requestFlag)
            {
                if (level != 0)
                {
                    var levelExpression = expression.GetLevelExpression(level);

                    if (levelExpression.NodeType == ExpressionType.MemberAccess)
                    {
                        var ma = (MemberExpression)levelExpression;

                        if (ma.Member.Name == "Key" && ma.Member.DeclaringType == _groupingType)
                        {
                            return(levelExpression == expression?
                                   _key.IsExpression(null, 0, requestFlag) :
                                       _key.IsExpression(expression, level + 1, requestFlag));
                        }
                    }
                }

                return(IsExpressionResult.False);
            }