title: ASP.NET MVC /Entity Framework Error - Invalid column name 'Environment_Id'
body: <p>I'm new to ASP.NET MVC and EF hopefully this is not a silly question</p>
  
  <p>When i pass model to view i'm getting this error - <strong>Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'Environment_Id'.</strong></p>
  
  <p>Model nor database table has a property by that name. Could any guide me on this?.</p>
  
  <pre><code>  **Here is the Version Model Class**
  
    public partial class Version
    {
      public Version()
      {
          this.ProfileVersions = new List&lt;ProfileVersion&gt;();
          this.ServerInfoes = new List&lt;ServerInfo&gt;();
      }
  
      public int Id { get; set; }
      public string Number { get; set; }
      public string Tag { get; set; }
      public string Owner { get; set; }
      public string Approver { get; set; }
      public string Description { get; set; }
      public virtual ICollection&lt;ProfileVersion&gt; ProfileVersions { get; set; }
      public virtual ICollection&lt;ServerInfo&gt; ServerInfoes { get; set; }
  }
  
  **Profile Version Class**
  
  public partial class ProfileVersion
  {
      public ProfileVersion()
      {
          this.PlatformConfigurations = new List&lt;PlatformConfiguration&gt;();
      }
  
      public int Id { get; set; }
      public int ProfileId { get; set; }
      public int EnvironmentId { get; set; }
      public int VersionId { get; set; }
      public Nullable&lt;bool&gt; Locked { get; set; }
      public string LockedBy { get; set; }
      public string Comments { get; set; }
      public Nullable&lt;int&gt; Active { get; set; }
      public virtual Environment Environment { get; set; }
      public virtual ICollection&lt;PlatformConfiguration&gt; PlatformConfigurations { get;  
                                                                               set; }
      public virtual PlatformProfile PlatformProfile { get; set; }
      public virtual Version Version { get; set; }
  }
  
  **ServerInfo** 
  public partial class ServerInfo
  {
      public ServerInfo()
      {
          this.PlatformConfigurations = new List&lt;PlatformConfiguration&gt;();
      }
  
      public int Id { get; set; }
      public string ServerName { get; set; }
      public int ProfileId { get; set; }
      public int VersionId { get; set; }
      public int EnvironmentId { get; set; }
      public string ServerType { get; set; }
      public Nullable&lt;short&gt; Active { get; set; }
      public string Domain { get; set; }
      public string Location { get; set; }
      public string IP { get; set; }
      public string Subnet { get; set; }
      public string Gateway { get; set; }
      public Nullable&lt;int&gt; VLan { get; set; }
      public string DNS { get; set; }
      public string OS { get; set; }
      public string OSVersion { get; set; }
      public string Func { get; set; }
      public Nullable&lt;short&gt; IISInstalled { get; set; }
      public string ADDomainController { get; set; }
      public string ADOrganizationalUnit { get; set; }
      public string ADGroups { get; set; }
      public string LastError { get; set; }
      public Nullable&lt;System.DateTime&gt; LastUpdate { get; set; }
      public virtual Environment Environment { get; set; }
      public virtual ICollection&lt;PlatformConfiguration&gt; PlatformConfigurations { get;      
                                                                               set; }
      public virtual PlatformProfile PlatformProfile { get; set; }
      public virtual Version Version { get; set; }
      public virtual VMConfiguration VMConfiguration { get; set; }
  }
  
   **Controller Code-**
  
   public ViewResult Index(string id )
      {
  
          var profileVerList = from ver in _context.Versions
                                  where !(from pfv in _context.ProfileVersions
                                      select pfv.VersionId).Contains(ver.Id)
                                  select ver;
  
          var bigView = new BigViewModel
          {
              VersionModel = profileVerList.ToList(),                
          };
  
          return View(model: bigView);
      }
  
  
  **In the View where the exception is thrown**
  
   @Html.DropDownList(
              "SelectedVersionID", 
              new SelectList(
                  Model.VersionModel.Select(x =&gt; new { Value = x.Id, Text = x.Number}),
                  "Value",
                  "Text"
                  )
              )
  </code></pre>