This project has moved and is read-only. For the latest updates, please go here.

Simple Remote Query

Remote Linq allows to create simple linq queries for a specific data type. It supports pagging, filtering, and sorting end-to-end by using complex predicates and criterias defined as linq expressions.

Sample:

class Client
{
  IService serviceProxy;

  public void QueryBusinessObjects()
  {
    long prodId = 5678L;

    // compose linq query
    IQuery<Order> query = new Query<Order>(serviceProxy.GetOrders)
      .Where(order => 
order.Items
.Where(i => i.ProductId == prodId)
.Sum(i => i.Quantity) > 1) .OrderByDescending(order => order.Items.Sum(i => i.TotalAmount)) .ThenBy(order => order.Items.Count()) .Take(10); // execute query -> retrieve data from server IEnumerable<Order> orders = query.ToList(); } }

 

class Server : IService
{
  IQueryable<Order> orderQueryable;

  public IEnumerable<Order> GetOrders(Query<Order> query)
  {
    List<Order> result = orderQueryable
      .ApplyQuery(query)
      .ToList();
    return result;
  }
}

 

Last edited Sep 11, 2014 at 10:14 PM by ChristofSenn, version 8