title: ASP.NET Core MVC model property binding is null
body: <p>I am using ASP.NET Core RC2 MVC with Entity Framework and trying to save a new car. The problem is, that in the create method of the car controller the property <strong>Color</strong> is <em>null</em> when the action is posted back. All other properties/fields are set. But the Color which refers to the <strong>CarColors</strong> model is null.</p>
  
  <p>The CarColor model</p>
  
  <pre><code>public class CarColor
  {
      [Key]
      public int CarColorId { get; set; }
  
      [MinLength(3)]
      public string Name { get; set; }
  
      [Required]
      public string ColorCode { get; set; }
  }
  </code></pre>
  
  <p>The main model Car</p>
  
  <pre><code>public class Car
  {
      [Key]
      public int CarId { get; set; }
  
      [MinLength(2)]
      public string Name { get; set; }
  
      [Required]
      public DateTime YearOfConstruction { get; set; }
  
      [Required]
      public CarColor Color { get; set; }
  }
  </code></pre>
  
  <p>The Cars controller</p>
  
  <pre><code>[HttpPost]
  [ValidateAntiForgeryToken]
  public async Task&lt;IActionResult&gt; Create([Bind("Color,Name,YearOfConstruction")] Car car)
  {
      if (ModelState.IsValid)
      {
          _context.Add(car);
          await _context.SaveChangesAsync();
          return RedirectToAction("Index");
      }
      return View(car);
  }
  </code></pre>
  
  <p>The request data:</p>
  
  <p><a href="https://i.stack.imgur.com/icGvf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/icGvf.png" alt="post request data"></a></p>
  
  <p>Debugging screenshot of the posted car</p>
  
  <p><a href="https://i.stack.imgur.com/1nqAn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1nqAn.png" alt="debugging screenshot"></a></p>
  
  <p>Can u give me a helping hand, how the property could be "bound" and so the <strong>ModelState.IsValid == true</strong>?</p>