Example #1
0
        public WhereExpression Where(Expression <Func <T, object> > expression)
        {
            var accessor = ReflectionHelper.GetAccessor(expression);

            ProjectionAlias.For(accessor, false).Each(x => _whereAliases.Fill(x));
            return(new WhereExpression(expression, _wheres));
        }
Example #2
0
 public bool Equals(ProjectionAlias other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     if (other.PropertyAccessor == null || PropertyAccessor == null)
     {
         return(false);
     }
     return(Equals(other.PropertyAccessor.PropertyNames[0], PropertyAccessor.PropertyNames[0]));
 }
        private ICriterion ConvertEqual(Expression exp)
        {
            var a = (BinaryExpression)exp;

            var left  = (MemberExpression)a.Left;
            var right = (ConstantExpression)a.Right;

            //need to walk the '.'s

            var bits     = getPath(left);
            var accessor = ReflectionHelper.GetAccessor(left);

            ProjectionAlias.For(accessor, false).Each(x => _whereAliases.Fill(x));

            return(global::NHibernate.Criterion.Expression.Eq(bits, right.Value));
        }