我尝试在运行在.NET核心6项目中的最小API中使用实体框架。据我所知,我应该运行dotnet ef dbcontext scaffold xxxx,但我没有收到任何错误,但是没有向我的项目添加任何模型。
有人能解释一下我如何使用DB第一方法和CRUD功能吗?
发布于 2022-08-31 01:24:00
我刚刚完成了这个练习,并遵循了以下步骤。
首先使用nuget软件包管理器安装以下程序:Microsoft.EntityFrameworkCore.Design和Microsoft.EntityFrameworkCore.SqlServer
然后在包管理器控制台中运行以下命令:
dotnet ef dbcontext scaffold "Data Source=.;Initial Catalog=databaseName;Trusted_Connection=true" Microsoft.EntityFrameworkCore.SqlServer --output-dir Entities我得到了下面的错误
The Entity Framework tools version '5.0.14' is older than that of the runtime '6.0.8'. Update the tools for the latest features and bug fixes. See https://aka.ms/AAc1fbw 然后在包管理器控制台中运行以下脚本:
dotnet tool update --global dotnet-ef --version 6.0.8https://stackoverflow.com/questions/72009430
复制相似问题