我有一个使用 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 选项的用途的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!