Exemplo n.º 1
0
        public ProxyCollection <object> Distinct(string field)
        {
            ExpressionFactory     factory = new ExpressionFactory(_context, typeof(T));
            Func <object, object> func    = factory.BuildValueExpression(field);

            IEnumerable <object> c = _collection.Select(val => func(val)).Distinct();

            return(new ProxyCollection <object>(c, _context));
        }
Exemplo n.º 2
0
        public ProxyCollection <T> OrderBy(string field, bool desc)
        {
            ExpressionFactory     factory = new ExpressionFactory(_context, typeof(T));
            Func <object, object> func    = factory.BuildValueExpression(field);

            IEnumerable <T> c;

            if (!desc)
            {
                c = _collection.OrderBy(val => func(val));
            }
            else
            {
                c = _collection.OrderByDescending(val => func(val));
            }

            return(new ProxyCollection <T>(c, _context));
        }