title: MVC, Linq - Sorting issue
body: <p>I get this error:</p>
  
  <blockquote>
    <p>DbSortClause expressions must have a type that is order comparable. Parameter name: key | at System.Data.Common.CommandTrees.ExpressionBuilder.Internal.ArgumentValidation.ValidateSortClause(DbExpression key) at System.Data.Common.CommandTrees.ExpressionBuilder.DbExpressionBuilder.ToSortClause(DbExpression key) at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.OrderByTranslatorBase.TranslateOneLambda(ExpressionConverter parent, DbExpressionBinding sourceBinding, DbExpression lambda) at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.OneLambdaTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, DbExpression&amp; source, DbExpressionBinding&amp; sourceBinding, DbExpression&amp; lambda) at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.OneLambdaTranslator.Translate(ExpressionConverter parent, MethodCallExpression call) at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod) at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq) at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator<code>1.Translate(ExpressionConverter parent, Expression linq) at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq) at System.Data.Objects.ELinq.ExpressionConverter.Convert() at System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable</code>1 forMergeOption) at System.Data.Objects.ObjectQuery<code>1.GetResults(Nullable</code>1 forMergeOption) at System.Data.Objects.ObjectQuery<code>1.System.Collections.Generic.IEnumerable&lt;T&gt;.GetEnumerator() at System.Data.Entity.Internal.Linq.InternalQuery</code>1.GetEnumerator() at System.Data.Entity.Infrastructure.DbQuery<code>1.System.Collections.Generic.IEnumerable&lt;TResult&gt;.GetEnumerator() at System.Collections.Generic.List</code>1..ctor(IEnumerable<code>1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable</code>1 source) at MvcMusicStore.Controllers.StoreManagerController.Index(String sortOrder) in </p>
  </blockquote>
  
  <p>When trying this code</p>
  
  <pre><code>var albums = db.Albums.Include(a =&gt; a.Genre).Include(a =&gt; a.Artist);
  
              switch (sortOrder) {
                  case "Artist desc":
                      albums = albums.OrderByDescending(o =&gt; o.Artist);
                      break;
                  case "Title desc":
                      albums = albums.OrderByDescending(o =&gt; o.Title);
                      break;
                  case "Title":
                      albums = albums.OrderBy(o =&gt; o.Title);
                      break;
                  case "Genre desc":
                      albums = albums.OrderByDescending(o =&gt; o.Genre);
                      break;
                  case "Genre":
                      albums = albums.OrderBy(o =&gt; o.Genre);
                      break;
                  default:
                      albums = albums.OrderBy(o =&gt; o.Artist);
                      break;
              }
  
              return View(albums.ToList());
  </code></pre>
  
  <p>I cannot find a way to sort it.</p>