Ignore properties in data model while keeping them in EF Core migrations

You have two alternatives:

  1. Using NotMappedAttribute:

    public class MyEntity
    {
         public int Id { get; set; }    
         [NotMapped]
         public string DeprecatedFeature { get; set; }
    }
    
  2. Using FluentAPI:

    modelBuilder.Entity<MyEntity>().Ignore(c => c.DeprecatedFeature);
    

Leave a Comment