entity-framework - 如何使用“dotnet ef 脚手架”从 sqlite 数据库创建模型?
问题描述
本教程只告诉我如何使用 SQL 数据库。
dotnet ef dbcontext scaffold "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -o Models -t Blog -t Post --context-dir Context -c BlogContext
解决方案
- 安装 .NET Core CLI
安装 Ef 工具
dotnet 工具安装 --global dotnet-ef
确保在您的项目中安装 Microsoft.EntityFrameworkCore.Designer 和 Microsoft.EntityFrameworkCore.Sqlite
从项目文件夹运行命令:
dotnet ef dbcontext 脚手架“数据源=C:\dbPath\db.sqlite”Microsoft.EntityFrameworkCore.Sqlite --output-dir DataModel
推荐阅读
- github-actions - 如何在 GitHub Actions 中的作业之间传递 API 令牌作为输出变量
- php - 使用 PHP 准备的 SQL Server 语句 - 错误
- pdf - 如何知道高级 PDF 中的翻译顺序?
- admob - admob 不会显示在所有设备上
- azure-data-explorer - 根据 Kusto 中最多一列获取其他列
- java - ProGuard 的 InvalidDefinitionException
- r - 如何将小标题/数据框列表转换为嵌套小标题/数据框
- python - 我注意到在重新打开的 .ipynb 笔记本中打开并重新运行单元格时,“pip install”会产生“无效语法”错误
- java - @Noncacheable 注释在 eclipselink 中无法正常工作
- javascript - 连接后如何更新钩子值?