title: Only parameterless constructors and initializers are supported in LINQ to Entitier in dropdown
body: <p>I have this controller</p>
  
  <pre><code>public ActionResult Create()
  {
      var db = new MyDbContext();
      IEnumerable&lt;SelectListItem&gt; items = db.FileUploadCategories
  
          .Select(c =&gt; new SelectListItem {
              Value = c.ParentCategoryID.ToString(),
              Text = "--" + c.CategoryName
          });
  
      ViewBag.Categories = items;
      return View();
  }
  </code></pre>
  
  <p>And a view like this</p>
  
  <pre><code> @Html.DropDownList("ParentCategoryID", (IEnumerable&lt;SelectListItem&gt;)ViewBag.Categories, "-- Select --", new { @class = "form-control" })
  </code></pre>
  
  <p>This gives me the this result on the website</p>
  
  <pre><code>&lt;select&gt;
  &lt;option value="0"&gt;Test&lt;/option&gt;
  &lt;option value="1"&gt;Test&lt;/option&gt;
  &lt;option value="1"&gt;Test&lt;/option&gt;
  &lt;option value="2"&gt;Test&lt;/option&gt;
  &lt;option value="2"&gt;Test&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>As you can see, some value are the same, which is because some ParentCategoryID from the controller is the same which is correct. What I would like to do is add a "-" in the text for each text in the options which will be determined by how large the value is. I want to add 3 ' - ' in text if the value is 3 and if the value is five, I want add five '-----' before the test in text. I want a result similar to this.</p>
  
  <pre><code>&lt;select&gt;
  &lt;option value="0"&gt;Test&lt;/option&gt;
  &lt;option value="1"&gt;-Test&lt;/option&gt;
  &lt;option value="1"&gt;-Test&lt;/option&gt;
  &lt;option value="2"&gt;--Test&lt;/option&gt;
  &lt;option value="2"&gt;--Test&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Notice the lines before the test.</p>
  
  <p>I have tried to update my controller to</p>
  
  <pre><code>Text = new String('-',c.ParentCategoryID) + c.CategoryName
  </code></pre>
  
  <p>Which gives me the error message</p>
  
  <blockquote>
    <p>An exception of type 'System.NotSupportedException' occurred in
    EntityFramework.SqlServer.dll but was not handled in user code</p>
    
    <p>Additional information: Only parameterless constructors and
    initializers are supported in LINQ to Entities.</p>
  </blockquote>