title: RIA Services - IQueryable Function With Multiple Parameters as Conditions
body: <p>I am developing an application with RIA Services, and in my DomainService class, I have all that standard functions generated by the RIA for general CRUD operations. The problem is that I tryed to create my own function that insted of listing all the the 45 columns in the Select statment, would list only 2 (NOM and PRENOM) and also according the parameters received in the clause Where.</p>
  
  <p>The Clause conditions are working perfectly, but the code is still returning all the 45 Columns instead of only the 2 specified. Here is the code:</p>
  
  <pre><code>    public IQueryable&lt;EMPLOYE&gt; GetEMPLOYEs(string strPRENOM, string strNOM)
      {
          IQueryable&lt;EMPLOYE&gt; query = this.Context.EMPLOYEs.AsQueryable();
  
          //This Doesn't work... all 45 clomuns are returned!!!
          query = from e in this.Context.EMPLOYEs select e;
          query.Select(e =&gt; new { e.PRENOM, e.NOM });
  
          // This Doesn't Work too!!!! Error:Cannot implicitly convert type 'System.Linq.IQueryable&lt;AnonymousType#1&gt;' to 'System.Linq.IQueryable&lt;AffPoste.Web.EMPLOYE&gt;'. An explicit conversion exists (are you missing a cast?)
          //query = from e in this.Context.EMPLOYEs select new{e.PRENOM, e.NOM};
  
           // Clause Conditions "Where"
           if (!String.IsNullOrEmpty(strPRENOM)) query = query.Where(e =&gt; e.PRENOM.Contains(strPRENOM));
              if (!String.IsNullOrEmpty(strNOM)) query = query.Where(e =&gt; e.NOM.Contains(strNOM));
  
          return query;
      }
  </code></pre>
  
  <p>Thanks In Advance.</p>