1
I’m using EF6
And it turns out that when I use Update-Database
it does not update my database.
For example
I have my model:
public class Cliente
{
public int Id {get;set}
public string Nome {get;set;}
}
If I add a new property:
public string CNPJ {get;set;}
And rotate Update-Database
or Update-Database -force
It does not update, and while accessing it error and informs to do Migrations
What I’ve done is:
enable-migrations
add-migration InitialCreate
In the file of Configuration
setei o AutomaticMigrationsEnabled
:
public Configuration()
{
AutomaticMigrationsEnabled = true;
}
With
AutomaticMigrationsEnabled
you don’t need to generate Migrations.– Leonel Sanches da Silva