In Code First we write the code first (Models) and let migration tools create tables.
From Tools --> Library Package Manager --> Package Manager Console.
Enter command: Enable-Migrations
This command adds a folder named Migrations and file Configuration.cs in the folder.
The file has Seed method to pre-load the tables with data.
Type command: Add-Migration Initial
update-database
The first command generates code that creates the database and second command executes that code.
No comments:
Post a Comment