剑轩

.net core nuget 安装ef相关的命令,ef常用依赖

电脑版发表于:2020/9/9 9:50


ef的核心安装,一般使用code first什么的只需要这一个就可以了

Install-Package Microsoft.EntityFrameworkCore.SqlServer -version 3.1.1



其他的例如db first需要的工具什么的,或者code first的数据库迁移

Install-Package Microsoft.EntityFrameworkCore.Tools -version 3.1.1
Install-Package Microsoft.EntityFrameworkCore.Design -version 3.1.1


或者ItemGroup里边

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Session" Version="2.2.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.10" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.10" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.10">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
  </ItemGroup>


注意ef core5.0版本的,没有UseSqlServer这个方法了





关于TNBLOG
TNBLOG,技术分享。技术交流:群号677373950
ICP备案 :渝ICP备18016597号-1
App store Android
精彩评论
{{item.replyName}}
{{item.content}}
{{item.time}}
{{subpj.replyName}}
@{{subpj.beReplyName}}{{subpj.content}}
{{subpj.time}}
猜你喜欢