Hi Calvin,
This is a feature that will be available with DevForce2010 v6.0.9.0. (returning projections in a query built dynamically)
Right now you can build the query dynamically, but it will return a collection of the Entity type being queried:
var expr1 = PredicateBuilder.Make(typeof(Employee), "LastName"
, FilterOperator.StartsWith
, "D");
var expr2 = PredicateBuilder.Make(typeof(Employee), "Country"
, FilterOperator.IsEqualTo
, "USA");
var expr12 = expr1.And(expr2);
var exprFunc = (Expression<Func<Employee, bool>>)expr12.ToLambdaExpression();
var query = mgr.Employees.Where(exprFunc);
var results = query.Execute(); // results is a collection of Employee
You can always query your large table and return a projection with only the desired fields:
var query = mgr.Employees
.Where(e => e.LastName.StartsWith("D") && Country.Equals("USA"))
.Select(e => new {Name = e.FirstName, e.City});
var results = query.Execute(); // results is a collection of projection { Name, City }
Note that upon execution a query will always return IEnumerable<T> where T is an Entity type or a projection.
Silvio.