public static IList ListData(string entityName, CriteriaOperator criteria) { var projections = GridViewExtension.GetColumnProjections(entityName); var fetchColumns = projections.Select(p => string.Format("{0} AS {1}", p.QueryExpression, p.Projection)).ToArray(); var selector = string.Format("new({0})", string.Join(",", fetchColumns)); IObjectSpace objectSpace = new ODataObjectSpace(); return(objectSpace.GetObjectQuery(entityName, selector, criteria).ToList()); }
private System.Collections.IList QueryData() { IObjectSpace objectSpace = new ODataObjectSpace(); var projections = GridViewExtension.GetColumnProjections(_objectName, _addtionProperties); var propertyDictionary = projections.ToDictionary(cp => cp.Projection, cp => cp.QueryExpression); var fetchColumns = propertyDictionary.Select(kvp => string.Format("{0} AS {1}", kvp.Value, kvp.Key)).ToArray(); var selector = string.Format("new({0})", string.Join(",", fetchColumns)); var list = objectSpace.GetObjectQuery(_objectName, selector, _filter).ToList(); return(list); }