title: Consuming Service Operations of an ADO.NET Data Service from a .NET Client
body: <p>I am trying to build an ADO.NET Data Service with lots of entities and a few service operations. On one side I created a ASP.NET Web Application, in which an ADO.NET Entity Data Model and an ADO.NET Data Service are located. On the other side I created a second ASP.NET Web Application that has a Service Reference to the Data Service.</p>
  
  <p>Entities are coming through very well, I can use LINQ to retrieve the data I want:</p>
  
  <pre><code>TestEntities entities = new TestEntities(
              new Uri("http://localhost/service/service.svc"));
  
  var query = from customer in entities.Customers
                      where customer.ID == 1234
                      select customer;
  
  query.ToList();
  </code></pre>
  
  <p>This works. However, retrieving information through Service Operations completely eludes me.
  Data Service-side code:</p>
  
  <pre><code>public static void InitializeService(IDataServiceConfiguration config) {
      config.SetEntitySetAccessRule("*", EntitySetRights.All);
      config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
  }
  
  [WebInvoke]
  public IQueryable&lt;Customer&gt; GetSomeCustomers() {
      TestEntities entities = new TestEntities();
      return from customer in entities.Customers
          where customer.ID &gt; 0 &amp;&amp; customer.ID &lt; 20
          select customer;
  }
  </code></pre>
  
  <p>When I added the Service reference to my client project, Visual Studio didn't pick up on any Service Operations. I know I can access them through constructed URIs and the BeginExecute method of either the DataServiceContext object or the TestEntities object (in this case), or something like that, but that is not how I want it.</p>
  
  <p>What I want is to use LINQ to go through the returned data of the Service Operation.
  Is this possible? It should be, right?</p>