Example #1
0
        protected override Expression VisitPropertyAccess(PropertyAccessExpression expr)
        {
            string name = MemberNameVisitor.GetMemberName(_rootCriteria, expr);

            _projections.Add(NHProjections.GroupProperty(name));

            return(expr);
        }
        protected override NewExpression VisitNew(NewExpression expr)
        {
            NewExpression newExpr = base.VisitNew(expr);

            _transformer = new TypeSafeConstructorMemberInitResultTransformer(expr);

            var aggregators = expr.Arguments.Where(arg => arg is MethodCallExpression && SupportsMethod(((MethodCallExpression)arg).Method.Name));

            if (aggregators.Any())
            {
                foreach (var exp in expr.Arguments.Except(aggregators))
                {
                    string propertyName = MemberNameVisitor.GetMemberName(_rootCriteria, exp);
                    if (!String.IsNullOrEmpty(propertyName))
                    {
                        _projections.Add(NHProjections.GroupProperty(propertyName));
                    }
                }
            }

            return(newExpr);
        }
Example #3
0
 public PropertyProjection Group()
 {
     return(Projections.GroupProperty(PropertyName));
 }
Example #4
0
 /// <summary>
 /// A grouping property value
 /// </summary>
 public static PropertyProjection Group(Expression <Func <object> > expression)
 {
     return(Projections.GroupProperty(ExpressionProcessor.FindMemberExpression(expression.Body)));
 }