Purpose of EF 6.x DbContext Generator option when adding a new data item in Visual Studio(在 Visual Studio 中添加新数据项时 EF 6.x DbContext Generator 选项的用途)
问题描述
我有一个使用 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.
这篇关于在 Visual Studio 中添加新数据项时 EF 6.x DbContext Generator 选项的用途的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Visual Studio 中添加新数据项时 EF 6.x DbContext G
- C# 通过连接字符串检索正确的 DbConnection 对象 2022-01-01
- Windows 喜欢在 LINUX 中使用 MONO 进行服务开发? 2022-01-01
- 为什么 C# 中的堆栈大小正好是 1 MB? 2022-01-01
- CanBeNull和ReSharper-将其用于异步任务? 2022-01-01
- 是否可以在 .Net 3.5 中进行通用控件? 2022-01-01
- 在 LINQ to SQL 中使用 contains() 2022-01-01
- 带问号的 nvarchar 列结果 2022-01-01
- 使用 rss + c# 2022-01-01
- Azure Active Directory 与 MVC,客户端和资源标识同一 2022-01-01
- 在 C# 中异步处理项目队列 2022-01-01
