title: Extension method not showing up
body: <p>I need help on how to show up my 2nd extension method "OrderBy" (shown below) in my ASP.Net MVC Controller.</p>
  
  <p>The 1st extension method "Where" is showing up but not "OrderBy". What do i need to do to make it show up? Or maybe my code is wrong in the 2nd extension method?</p>
  
  <p>NOTE: I have already imported the namespace in my controller by adding:</p>
  
  <pre><code>using MyApplication.Models;
  </code></pre>
  
  <p>Here's my code for the extension methods:</p>
  
  <pre><code>namespace MyApplication.Models
  {
      public static class ExtensionMethods
      {
          public static IQueryable&lt;T&gt; Where&lt;T&gt;(this IQueryable&lt;T&gt; source, string     columnName, string value, string filterType)
          {
  
          ParameterExpression table = Expression.Parameter(typeof(T), "x");
          MemberExpression column = Expression.PropertyOrField(table, columnName);
          Expression valueExpression = null;
          Expression where = null;
  
          if (column.Type.FullName.Contains("String")) {...}
          if (column.Type.FullName.Contains("Int32")) {...}
          if (column.Type.FullName.Contains("DateTime")){...}
  
          var predicate = Expression.Lambda&lt;Func&lt;T, bool&gt;&gt;(where, table);
  
          return source.Where(predicate);
          }
  
          public static IOrderedQueryable&lt;T&gt; OrderBy&lt;T,TKey&gt;(this IQueryable&lt;T&gt; source,   string columnName)
          {
              ParameterExpression table = Expression.Parameter(typeof(T), "x");
              Expression column = Expression.PropertyOrField(table, columnName);
              var keySelector = Expression.Lambda&lt;Func&lt;T, TKey&gt;&gt;(column,table);
              return source.OrderBy(keySelector);
          }
      }
  }
  </code></pre>
  
  <p>Here's the code in the Controller:</p>
  
  <pre><code>using MyApplication.Models;
  
  ...
  
  using (MyContext context = new MyContext())
  {
  
      IQueryable&lt;Shipper&gt; query = context.Shippers;
      query = query.Where(property,value,filterType);
      query = query.OrderBy(property);
  }
  </code></pre>
  
  <p>Any help is greatly appreciated.</p>
  
  <p>-Mark</p>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Here's my new OrderBy extension method:</p>
  
  <pre><code>public static IOrderedQueryable&lt;T&gt; OrderBy&lt;T&gt;(this IQueryable&lt;T&gt; source, string columnName, bool asc)
      {
          var entityType = typeof(T);
          var property = entityType.GetProperty(columnName);
          ParameterExpression table = Expression.Parameter(entityType, "x");
          Expression column = Expression.PropertyOrField(table, columnName);
  
          string sortMethod="";
  
          if (asc) { sortMethod = "OrderBy"; }
          else { sortMethod = "OrderByDescending"; }
  
          var keySelector = Expression.Lambda(column,table);
  
          MethodCallExpression resultExp = Expression.Call(
              typeof(Queryable),
              sortMethod,
              new Type[] { entityType, property.PropertyType },
              source.Expression,
              Expression.Quote(keySelector));
  
          return (IOrderedQueryable&lt;T&gt;)source.Provider.CreateQuery&lt;T&gt;(resultExp);
      }
  </code></pre>