title: LINQ Generic Join and Entity Framework
body: <p>My requirement is to implement a Generic Join method which would IQueryable Join .</p>
  
  <p>I have used the Join method as shown below :</p>
  
  <pre><code>public static IQueryable Join(this IQueryable outer, IEnumerable inner, string outerSelector, string innerSelector, string resultsSelector, params object[] values)
      {
          if (inner == null) throw new ArgumentNullException("inner");
          if (outerSelector == null) throw new ArgumentNullException("outerSelector");
          if (innerSelector == null) throw new ArgumentNullException("innerSelector");
          if (resultsSelector == null) throw new ArgumentNullException("resultsSelctor");
  
          System.Linq.Expressions.LambdaExpression outerSelectorLambda = DynamicExpression.ParseLambda(outer.ElementType, null, outerSelector, values);
          System.Linq.Expressions.LambdaExpression innerSelectorLambda = DynamicExpression.ParseLambda(inner.AsQueryable().ElementType, null, innerSelector, values);
  
          System.Linq.Expressions.ParameterExpression[] parameters = new System.Linq.Expressions.ParameterExpression[] {
          System.Linq.Expressions.Expression.Parameter(outer.ElementType, "outer"), System.Linq.Expressions.Expression.Parameter(inner.AsQueryable().ElementType, "inner") };
          System.Linq.Expressions.LambdaExpression resultsSelectorLambda = DynamicExpression.ParseLambda(parameters, null, resultsSelector, values);
  
          return outer.Provider.CreateQuery(
              System.Linq.Expressions.Expression.Call(
                  typeof(Queryable), "Join",
                  new Type[] 
                  { 
                      outer.ElementType, 
                      inner.AsQueryable().ElementType, 
                      outerSelectorLambda.Body.Type, 
  
                      resultsSelectorLambda.Body.Type 
                  },
                  outer.Expression, 
                  inner.AsQueryable().Expression, 
                  System.Linq.Expressions.Expression.Quote(outerSelectorLambda), 
                  System.Linq.Expressions.Expression.Quote(innerSelectorLambda), 
                  System.Linq.Expressions.Expression.Quote(resultsSelectorLambda)));
      }
  
  
      //The generic overload.
      public static IQueryable&lt;T&gt; Join&lt;T&gt;(this IQueryable&lt;T&gt; outer, IEnumerable&lt;T&gt; inner, string outerSelector, string innerSelector, string resultsSelector, params object[] values)
      {
          return (IQueryable&lt;T&gt;)Join((IQueryable)outer, (IEnumerable)inner, outerSelector, innerSelector, resultsSelector, values);
      }
  </code></pre>
  
  <p>I have used the Join method as shown below :</p>
  
  <pre><code>       var q = Join(e1, e2, "Company_ID", "Company_ID",
          "new ( outer.Company_ID as CompanyId)"      );
  </code></pre>
  
  <p>But i get the error as shown below : </p>
  
  <p>No generic method 'Join' on type 'System.Linq.Queryable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic.</p>
  
  <p>Please Help . </p>