I am planning a WCF service to return lists, data, all the usual things.
Now I saw on here ages ago that as of .NET 4.5 you could pass lambda expressions or filters to WCF (I also saw something in a pluralsight video somewhere) that allowed you to write something along the lines of
IQuerable<string> GetInfo();
// or
List<string> GetInfo(Expression predicate);
Instead of
GetInfo(int page, int resultsPerPage, bool sortAsc, string sortColumn);
However, as I'm reading around I see lots of conflicting (and old) information saying that this isnt possible. Is it then at all possible to filter WCF results before they are returned via some linq or lambda expression?
Update
I have implemented a Service (WCF not WCF Data Services) like so, and I get the expected result. Is the client actually passing the query to the web service or is it being rendered client side?
public class Service1 : IService1
{
public IQueryable<string> DoWork()
{
List<string> strings = new List<string>();
for (char c = 'a'; c < 'z'; c++)
{
strings.Add(c.ToString());
}
return strings.AsQueryable();
}
}
Client:
Service1 s = new Service1();
var results = s.DoWork();
var results1 = results.Where(str => str == "a"); // works