title: One or more validation errors were detected during model generation:\r\n\r\n
body: <p>I am so confused. I am working on building a cascading dropdown and I am receiving the strangest error. I keep receiving the following error (it is a long one)- </p>
  
  <p><em>"One or more validation errors were detected during model generation:\r\n\r\nAQB_MON.ViewModels.DeviceStatu: : EntityType 'DeviceStatu' has no key defined. Define the key for this EntityType.\r\nAQB_MON.ViewModels.SelectListItem: : EntityType 'SelectListItem' has no key defined. Define the key for this EntityType.\r\nDeviceStatus: EntityType: EntitySet 'DeviceStatus' is based on type 'DeviceStatu' that has no keys defined.\r\nSelectListItems: EntityType: EntitySet 'SelectListItems' is based on type 'SelectListItem' that has no keys defined.\r\n"}</em> </p>
  
  <p>I have a Manufacturer table and a ManufacturerModel table. My cascading dropdown consists of a user selecting a manufacturer first and then corresponding model options would be available in the second dropdown. However I keep receiving the error when trying to load the dropdown.</p>
  
  <p>I created my own ViewModel - ManufacturerModelContext</p>
  
  <pre><code>public class ManufacturerModelContext : DbContext
  {
  
      public DbSet&lt;Manufacturer&gt; Manufacturers { get; set; }
      public DbSet&lt;ManufacturerModel&gt; ManufacturerModels { get; set; }
  }
  </code></pre>
  
  <p>and I retrieve Manufacturers and Models with </p>
  
  <pre><code>//Populate the cascading dropdowns for manufacturer and model
      ManufacturerModelContext mm = new ManufacturerModelContext();
      [HttpGet]
      public JsonResult GetManufacturers()
      {
  
          var manufacturer = from a in mm.Manufacturers
                             select a.Manufacturer1;
  
          return Json(manufacturer.ToList(), JsonRequestBehavior.AllowGet);
  
      }
  
      public JsonResult GetModelsByManufacturerID(string manufacturerId)
      {
  
          int Id = Convert.ToInt32(manufacturerId);
  
          var models = from a in mm.ManufacturerModels where a.ManufacturerID == Id select a;
  
          return Json(models);
      }
  </code></pre>
  
  <p>It fails at <em>Var manufacturer</em>. The strangest thing is that I don't even have and never did have a <em>AQB_MON.ViewModels.DeviceStatu</em></p>
  
  <p>Manufacturer Model </p>
  
  <pre><code>public partial class Manufacturer
  {
      public Manufacturer()
      {
          this.ManufacturerModels = new HashSet&lt;ManufacturerModel&gt;();
      }
  
      public int ManufacturerID { get; set; }
      [Display(Name="Manufacturer")]
      public string Manufacturer1 { get; set; }
      [Display(Name="Manufacturer Description")]
      public string ManufacturerDescription { get; set; }
      public System.DateTime DATE_CREATED { get; set; }
      public string CREATED_BY { get; set; }
      public Nullable&lt;System.DateTime&gt; DATE_MODIFIED { get; set; }
      public string MODIFIED_BY { get; set; }
  
      public virtual ICollection&lt;ManufacturerModel&gt; ManufacturerModels { get; set; }
  </code></pre>
  
  <p>ManufacturerModel Model</p>
  
  <pre><code>public partial class ManufacturerModel
  {
      public ManufacturerModel()
      {
          this.Devices = new HashSet&lt;Device&gt;();
      }
  
      public int ManufacturerModelID { get; set; }
      [Display(Name="Manufacturer")]
      public int ManufacturerID { get; set; }
      public string Model { get; set; }
      [Display(Name="Model Description")]
      public string ModelDescription { get; set; }
      public System.DateTime DATE_CREATED { get; set; }
      public string CREATED_BY { get; set; }
      public Nullable&lt;System.DateTime&gt; DATE_MODIFIED { get; set; }
      public string MODIFIED_BY { get; set; }
  
      public virtual ICollection&lt;Device&gt; Devices { get; set; }
      public virtual Manufacturer Manufacturer { get; set; }
  </code></pre>
  
  <p>Device Model</p>
  
  <pre><code> public partial class Device
  {
      public Device()
      {
          this.DeviceLocations = new HashSet&lt;DeviceLocation&gt;();
          this.DeviceLogs = new HashSet&lt;DeviceLog&gt;();
          this.DeviceStatus = new HashSet&lt;DeviceStatu&gt;();
      }
  
  
      public int DeviceID { get; set; }
      [Display(Name = "Device Type")]
      public int DeviceTypeID { get; set; }
      public int ManufacturerModelID { get; set; }
      [Display(Name="Inventory Number")]
      public string InventoryNumber { get; set; }
      [Display(Name = "Serial Number")]
      public string SerialNumber { get; set; }
      [Display(Name = "State ID")]
      public string StateID { get; set; }
      [Display(Name = "Date Received")]
      [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
      public DateTime? DateReceived { get; set; }
      public Nullable&lt;decimal&gt; Price { get; set; }
      public string Notes { get; set; }
      public System.DateTime DATE_CREATED { get; set; }
      public string CREATED_BY { get; set; }
      public Nullable&lt;System.DateTime&gt; DATE_MODIFIED { get; set; }
      public string MODIFIED_BY { get; set; }
  
  
      public virtual DeviceType DeviceType { get; set; }
      public virtual ManufacturerModel ManufacturerModel { get; set; }
      public virtual ICollection&lt;DeviceLocation&gt; DeviceLocations { get; set; }
      public virtual ICollection&lt;DeviceLog&gt; DeviceLogs { get; set; }
      public virtual ICollection&lt;DeviceStatu&gt; DeviceStatus { get; set; }
  </code></pre>