.net core EF 命令

http://www.bsjobjob.com 璧山人才网璧山招聘网git

 

https://docs.microsoft.com/zh-cn/ef/core/what-is-new/ef-core-2.0  ef 命令github

https://github.com/aspnet/EntityFrameworkCore 开源地址sql

.net core EF 依赖库Microsoft.EntityFrameworkCore.SqlServer数据库

                              Microsoft.EntityFrameworkCoremvc

                              Microsoft.EntityFrameworkCore.Design.net

依赖库 Microsoft.EntityFrameworkCore.Tools.DotNet 节点 DotNetCliToolReference教程

 

<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />ip

dotnet ef migrations add InitialCreate 迁移仓库rem

dotnet ef migrations list 列出全部能够迁移的仓库get

dotnet ef  migrations remove 移除迁移项目

dotnet ef  migrations script 生成脚本可是不保存到文件

services.AddDbContext<EFBlogDbContext>(options=>options.UseSqlServer(Configuration.GetConnectionString("BloggingDatabase"),t=>t.MigrationsAssembly("mvc")));  注意t表达表达式 当ef和 mvc 不是一个项目时才须要t 表达式

dotnet ef migrations script -o  outpu.sql  生成数据库脚本

dotnet ef database update drop 删除数据库

dotnet ef database update update 更新数据库 建议先生成脚本

dotnet ef dbcontext info          获取 dbcontext 基本信息

dotnet ef dbcontext  list            获取全部dbcontext 基本信息

dotnet ef dbcontext scaffold             查看是否支持entity的dbcontext基本信息

 

更多细节参考 https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet

基本教程参考 https://docs.microsoft.com/en-us/ef/core/modeling/included-types

相关文章
相关标签/搜索