title: entity cannot be constructed in a LINQ to Entities query
body: <p>My entity Person is generated by EF. I'm trying to show the firstname in a autocomplete textbox when you search for a specific character, just like a facebook search. When I try to run i get the error-message: </p>
  
  <pre class="lang-none prettyprint-override"><code>The entity or complex type 'Dejtingsajt3.Repositories.Person' cannot be constructed in a LINQ to Entities query.
  </code></pre>
  
  <p>This is my script-code from the .html-page:</p>
  
  <pre><code>&lt;script&gt;
      $("#searchInput").autocomplete({
          source: function (request, response) {
              $.ajax({
                  url: '@Url.Action("GetSearchValue", "Home")',
                  dataType: "json",
                  data: { search: $("#searchInput").val() },
                  success: function (data) {
                      response($.map(data, function (item) {
                          return { label: item.FirstName, value: item.FirstName };
                      }));
                  },
                  error: function (xhr, status, error) {
                      alert("Error");
                  }
              });
          }
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>This is my method from the controller:</p>
  
  <pre><code>public class HomeController : Controller
  {
      private DataContext dataContext = new DataContext();
  
      public ActionResult Index()
      {
          return View();
      }
  
      public JsonResult GetSearchValue(string search)
      {
          List&lt;Person&gt; allSearch = dataContext.User.Where(n =&gt; n.FirstName
          .Contains(search)).Select(x =&gt; new Person
          {
              FirstName = x.FirstName
  
          }).ToList();
  
          return new JsonResult {Data=allSearch, JsonRequestBehavior =
              JsonRequestBehavior.AllowGet };
      }
  }
  </code></pre>
  
  <p>And this is my person-entity:</p>
  
  <pre><code>public class Person
  {
      public Person()
      {
          FriendRequestReceive = new HashSet&lt;FriendRequest&gt;();
          FriendRequestSend = new HashSet&lt;FriendRequest&gt;();
          MessageRecieve = new HashSet&lt;Message&gt;();
          MessageSend = new HashSet&lt;Message&gt;();
      }
  
      [Key]
      public int PersonID { get; set; }
  
      [Required(ErrorMessage = "A first name is required.")]
      [Display(Name = "First Name")]
      public string FirstName { get; set; }
  
      [Required(ErrorMessage = "A last name is required.")]
      public string LastName { get; set; }
  
      [Required(ErrorMessage = "A social number is required.")]
      public string SocialNumber { get; set; }
  
      [Required(ErrorMessage = "A gender is required.")]
      public string Gender { get; set; }
  
      [Required(ErrorMessage = "A city is required.")]
      public string City { get; set; }
  
      [EmailAddress(ErrorMessage = "Please enter a valid email.")]
      public string Mail { get; set; }
  
      public string ProfilePicture { get; set; }
  
      public string PresentationText { get; set; }
  
      public string Preference { get; set; }
  
      [Required(ErrorMessage = "A username is required.")]
      public string UserName { get; set; }
  
      [Compare("Password", ErrorMessage = "A password is required")]
      [DataType(DataType.Password)]
      public string Password { get; set; }
  
      public virtual ICollection&lt;FriendRequest&gt; FriendRequestReceive { get; set; }
      public virtual ICollection&lt;FriendRequest&gt; FriendRequestSend { get; set; }
      public virtual ICollection&lt;Message&gt; MessageRecieve { get; set; }
      public virtual ICollection&lt;Message&gt; MessageSend { get; set; }
      public string FileName { get; internal set; }
      public string ContentType { get; internal set; }
      public byte[] File { get; internal set; }
  }
  </code></pre>
  
  <p>I have searched for a solution and tried some different approaches but without any luck.</p>