Пример #1
0
            public override Expression BuildExpression(Expression expression, int level, bool enforceServerSide)
            {
                if (expression == null)
                {
                    return(BuildGrouping());
                }

                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)
                        {
                            var isBlockDisable = Builder.IsBlockDisable;

                            Builder.IsBlockDisable = true;

                            var r = ReferenceEquals(levelExpression, expression) ?
                                    _key.BuildExpression(null, 0, enforceServerSide) :
                                    _key.BuildExpression(expression, level + 1, enforceServerSide);

                            Builder.IsBlockDisable = isBlockDisable;

                            return(r);
                        }
                    }
                }

                throw new NotImplementedException();
            }
Пример #2
0
            public override Expression BuildExpression(Expression expression, int level)
            {
                if (expression == null)
                {
                    return(BuildGrouping());
                }

                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(ReferenceEquals(levelExpression, expression) ?
                                   _key.BuildExpression(null, 0) :
                                   _key.BuildExpression(expression, level + 1));
                        }
                    }
                }

                throw new NotImplementedException();
            }