标签:time 库文件 数据 code pac sch str typename database
在asp.net4.5框架下使用codeFirst添加和修改数据库文件小结。
建立:
1、建立模型类
2、In Package Manager Console, run the command:enable-migrations -ContextTypeName ContosoUniversityModelBinding.Models.SchoolContext
3、系统自动产生configuration.cs文件,其中的seed方法用来初始化数据库
4、Run the command update-database
5、The database file has been added
修改:
1、修改模型类的字段
2、 In the Package Management window, add a migration by running the command add-migration AddEnrollmentDate. Notice that 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 the code in the Seed method. Save and close the file.
4、Now, run the command update-database.
Asp.net WebForm使用codeFirst建立和修改数据库小结
标签:time 库文件 数据 code pac sch str typename database
原文地址:http://www.cnblogs.com/xzitluyang/p/6130778.html