1.写一个继承于identityDbContext的DbContext 并创建构造方法。
2.注册identity和dbcontext服务
3.迁移 Add-Migration AddProductReviews
4.在连接字符串中写入要添加的数据库
5.更新数据库 Update-Database
6.生成数据库实体类
Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
同时
1.写一个继承于DbContext的DbContext 并创建构造方法。
2.注册identity和dbcontext服务 重新生成
6.生成数据库实体类
Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
3.迁移 Add-Migration AddMigration
4.在连接字符串中写入要添加的数据库
5.更新数据库 Update-Database
oil覆盖
生成数据库实体类
Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
一个继承于identityDbContext的DbContext 并创建构造方法。
2.注册identity和dbcontext服务 重新生成
3.迁移 Add-Migration AddMigration
4.在连接字符串中写入要添加的数据库
覆盖报错 修改Migration 中 up方法 删除不需要新增的表
5.更新数据库 Update-Database
本文介绍了如何在MySQL中创建Identity数据库表格,包括创建继承于identityDbContext的DbContext,注册服务,进行迁移操作,更新数据库,并生成数据库实体类的详细步骤。同时也提到了可能出现的问题及解决方法,如迁移冲突和覆盖报错的处理。
481

被折叠的 条评论
为什么被折叠?



