在 Visual Studio 中添加新数据项时 EF 6.x DbContext Generator 选项的用途
- 作者: flies
- 来源: 51数据库
- 2022-12-13
问题描述
我有一个使用 LINQ to SQL 构建的 Web 应用程序,我希望将其升级到 LINQ to Entity Framework.我查看了一些教程,我了解到基本上在数据库优先的场景中,您创建了一个 ADO.NET 实体数据模型.然后,您可以选择要包含在模型中的表(与 LINQ to SQL 非常相似).
I have a web app that I built using LINQ to SQL and I'm looking to upgrade it to LINQ to Entity Framework. I've looked at some tutorials and what I've learned is that basically in the database-first scenario, you create an ADO.NET Entity Data Model. And from there, you select which tables to include in the model (very similar to LINQ to SQL).
在添加新项目对话框中,我看到还有另一个选项可以创建EF 6.x DbContext Generator:
Within the Add New Item dialog, I see that there is another option that creates an EF 6.x DbContext Generator:
与 ADO.NET 实体数据模型(对话框中的第一个选项)相比,EF 6.x DbContext Generator 的目的是什么?而且,EF 6.x DbContext Generator 有什么用?它似乎创建了一个文本文件.我该怎么办?
What is the purpose of EF 6.x DbContext Generator compared to ADO.NET Entity Data Model (first option in dialog)? And, what is EF 6.x DbContext Generator for? It seems to create a text file. What should I do with it?
推荐答案
如果您已经有一个数据库,那么第一个选项更好,因为该方法与您已经在 LinqToSQL 中使用的方法非常相似..EDMX 文件还可以为您提供数据库的图形可视化,而您不必担心其他任何事情.
If you already have a database, the first option is better, given that the approach is very similar to the one you are already working in LinqToSQL. The .EDMX file also can provide you a graphical visualization of your database, and you don't have to worry about anything else.
- C#通过fleck实现wss协议的WebSocket多人Web实时聊天(附源码)
- 团队城市未满足要求:MSBuildTools12.0_x86_Path 存在
- 使用 MSBuild.exe 在发布模式下构建 C# 解决方案
- 当我发布 Web 应用程序时,AfterPublish 脚本不运行
- 构建时 T4 转换的产品仅在下一个构建中使用
- ASP.NET Core Application (.NET Framework) for Windows x64 only error in project.assets.json
- 新的 .csproj 格式 - 如何将整个目录指定为“链接文件"到子目录?
- 如何将条件编译符号(DefineConstants)传递给 msbuild
- MSBuild 支持 Visual Studio 2017 RTM 中的 T4 模板
- NuGet 包还原找不到包,没有源
