title: Ignore properties in data model while keeping them in EF Core migrations
body: <p>I am creating a greenfield application that uses EF Core which must talk to a legacy database. I want EF to ignore some of the columns in the database because they will eventually be deprecated and I don't want them in the new entity model. I can't remove them yet as the legacy system still relies on them.</p>
  
  <p>For an unwanted database column called <code>DeprecatedFeature</code>, I want to do something like:</p>
  
  <pre><code>modelBuilder.Entity&lt;MyEntity&gt;(entity =&gt; {
     entity.HasKey(t =&gt; t.Id);
     entity.ToTable("MyEntity");
     entity.ColumnIgnore("DeprecatedFeature"); // &lt;-- this is what I want to do
  })
  </code></pre>
  
  <p>Right now, the best I can do is include the property and mark it as obsolete:</p>
  
  <pre><code>public class MyEntity 
  {
      public int Id { get; set; }
  
      [Obsolete("Deprecated in latest version")]
      public string DeprecatedFeature { get; set; }
  }
  </code></pre>
  
  <p>But that means I can't turn on "warnings as errors". I still need to run migrations on my database.</p>
  
  <p>Similar questions: <a href="https://stackoverflow.com/questions/11853636/how-do-i-tell-ef-to-ignore-columns-from-my-database">EF 4.x</a>, <a href="https://stackoverflow.com/questions/46122299/entityframework-core-2-0-skip-loading-column">EF Core skip column on load</a>, <a href="https://stackoverflow.com/questions/737520/entity-framework-ignore-columns?rq=1">Using EF Designer/EDMX</a> and <a href="https://stackoverflow.com/questions/16476272/ignore-a-specific-column-in-entity-framework?rq=1">duplicate</a></p>
  
  <h1>Edit</h1>
  
  <p>I can see by the answers that there is some confusion about my question:</p>
  
  <h2>NotMapped is NOT the answer</h2>
  
  <p><code>NotMapped</code> is used when you have a property in your model that you don't want in the database. My problem is the other way around. I have a column in my database that I don't want in my model.</p>