EF常用命令笔记

EF常用命令

  • 数据库迁移

    Add-Migration [标识名] ----当前所有上下文

    Add-Migration [标识名] -c [数据库上下文名称] -o [迁移文件存放目录] -------迁移指定上下文

  • 更新迁移到数据库

    update -database ----更新当前所有上下文

    update -database -c [数据库上下文名称]

  • 删除迁移

    Remove-Migration

  • 取消更新到数据库

    Drop-Database

donet命令

  • 迁移

    dotnet ef migrations add InitialCreate
    
  • 更新数据库

    dotnet ef database update
    
posted @ 2022-07-09 13:04  码农阿亮  阅读(154)  评论(0编辑  收藏  举报