For this error:
An unhandled exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll
Additional information: The model backing the 'SchoolContext' context has changed since the database was created. Consider using Code First Migrations to update the database ( link ).
You have mapped the Models but did not generate the incremental variation of the database, called Migration . To generate a Migration open the Package Manager Console (View> Other Windows > Package Manager Console) and type:
PM> Add-Migration NomeDaMigration
This will generate a file with the modifications that should be made to the database. After that, type now:
PM> Update-Database
This will update your database with the modifications made to your Models . That done, just run your application.
If this error appears:
No migrations configuration type was found in the 'School' assembly. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)
In the Package Manager Console, type:
PM> Enable-Migrations
Wait for Visual Studio to configure your project, then repeat the steps to generate your Migration again:
PM> Add-Migration Inicial
PM> Update-Database