title: EF Update DB Enable Migration Navigational Property Error
body: <p>I am using EF Migrations with MVC 5 - however I'm getting what I think/thought was/is a pretty common error, but the common solutions I've seen, I've already got:</p>
  
  <p><em>The property 'companyId' cannot be configured as a navigation property.The property must be a valid entity type and the property should have a non-abstract getter and setter. For collection properties the type must implement ICollection where T is a valid entity type.</em></p>
  
  <p>From looking around my code looks correct, and worked prior to <em>enable-migrations</em> and <em>update-database</em> to see whether the test data in my system gets wiped before I put this change live. Within the ASN model I've added a string property of testAsn to see whether this gets added as a column to the database.</p>
  
  <p>I am unsure if this error is relating to the ASN or the Contacts table/model, but they both have the same implementation.</p>
  
  <p>Have I misunderstood regarding the use of navigational properties? Any help would be greatly appreciated. </p>
  
  <p><strong>Models</strong></p>
  
  <pre><code>[Table("Company")]
  
      public class Company
      {
          [Key]
          public int companyId { get; set; }
          [Required(ErrorMessage="Company name required.")]
          [StringLength(100)]
          public string name { get; set; }
          [Required(ErrorMessage = "Telephone required.")]
          public string telephone { get; set; }
          [Required(ErrorMessage="Registration Number required.")]
          [StringLength(30)]
          public string regNumber { get; set; }
          // navigation properties  of the models that belong to the company
          public virtual IList&lt;Asn&gt; asns { get; set; }
          public virtual IList&lt;Contact&gt; contacts { get; set; }
      }
  [Table("Asn")]
      public class Asn
      {
          [Key]
          public int asnId { get; set; }
          public int companyId { get; set; }
          [ForeignKey("companyId")]
          // property I'm adding to test whether migrations is working
          public string testAsn { get; set; }
          // *******************************
          // as pointed out in the correct answer, the property below
          // this comment should be above testAsn
          // *******************************
          public virtual Company company { get; set; }
          [Required] // always has value
          public bool userBehalf { get; set; }
          [Required] // always has value
          public bool confirmAssignment { get; set; }
          [Required(ErrorMessage="Prefix required.")]
          public string prefixAnnounced { get; set; }
          [Required(ErrorMessage="Pending Ticket ID required.")]
          public string pendingTicket { get; set; }
          [DataType(DataType.MultilineText)]
          public string comments { get; set; }
          public bool asNumType { get; set; }
          public string reason { get; set; }
      }
      [Table("Contact")]
      public class Contact
      {
          [Key]
          public int contactId { get; set; }
          public int companyId { get; set; }
          [ForeignKey("companyId")]
          public virtual Company company { get; set; }
          [StringLength(100, MinimumLength=3)]
          [Required(ErrorMessage="Contact name required.")]
          public string name { get; set; }
          [Required(ErrorMessage="Telephone required.")]
          [StringLength(30, MinimumLength=11)]
          public string telephone { get; set; }
          [Required]
          [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
                              @"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" +
                              @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$",
                              ErrorMessage = "Email is not valid.")]
          public string email { get; set; }
          [Required(ErrorMessage = "Contact type required.")]
          public string type { get; set; }
      }    
  </code></pre>