title: Add leading zeros with LINQ and Entity Framework
body: <p>I try to add leading zeros in my ASP MVC application via Linq:</p>
  
  <pre><code>int length = 4;
  IEnumerable&lt;object&gt; query = [...]
  select new
      {
          Seq = a.Seq.ToString("D" + length),
      }).OrderBy(a =&gt;a.Seq).ToList();
  </code></pre>
  
  <p>.. but I receive the following error:</p>
  
  <pre><code>Additional information: LINQ to Entities does not recognize the method 'System.String ToString(System.String)' method, and this method cannot be translated into a store expression.
  </code></pre>
  
  <p>What is the correct method to do this?</p>