I am using Entity Framework's automatic migrations with a code-first approach. I dont use the packet manager console and dont have access to coded migrations.
I have a line representing my table in my model here :
public virtual DbSet<Customer> Customers { get; set; }
I renamed one of the fields of Customer :
[Table("Customers")]
public partial class Customer
{
[Key]
[Column(TypeName = "numeric")]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int idCustomer { get; set; }
public string name { get; set; }
public int age { get; set; }
public string mail { get; set; }
public string password { get; set; }
}
I just changed "mail" to "mailModified". But when the database got updated, Entity deleted all data from the name field. I think it deleted my column to create a new one with the new name.
How to avoid that ? How to make him understand to only rename the column ?
Thanks for any participation