Use Codefirst to add and modify database file summaries under the asp.net4.5 framework.
Establish:
1. Building Model Classes
2. In package Manager Console, run the command:
enable-migrations -ContextTypeName ContosoUniversityModelBinding.Models.SchoolContext
3. The system automatically generates the Configuration.cs file, where the seed method is used to initialize the database
4. Run the commandupdate-database
5. The database file has been added
Modify:
1. Modify the field of the Model class
2, in the Package Management window, add a migration by running the command add-migration addenrollmentdate. Notice The migration code adds the new Datetime column to the Student table.
3, Therefore, open Configuration.cs in the Migrations folder and remove or comment out of the code in the seed method. Save and close the file.
4. Now, run the command update-database.
ASP. WebForm using Codefirst to create and modify database summaries