Entity Framework 4.1 automatically generates using DbContext when creating ADO.NET Entity Data Model

I would like to work with DbContext instead of ObjectContext. I updated EF, so now I have a DbContext, but I want to create my strongly typed context based on DbContext, not ObjectContext. When I add a new Entity Data ADO.NET data model, it is still based on ObjectContext. Is it not possible to use the DbContext database in Visual Studio 2010 with EF 4.1?

UPDATE:

Well, I followed the directions in this and was able to create DbContext template objects. However, now he talks about the presence of ambiguity between the template objects and the objects in my .edmx file. How do I resolve this? Do I delete .edmx files?

+5
source share
2 answers

Ok, I got this to work by right-clicking on the .edmx diagram and selecting "Add Code Generation Element ..." and then selecting "EF 4.x DbContext Generator" from the options. It worked great.

+8
source

You can generate an ObjectContext from an existing edmx file, just go to the edmx change properties "Code Generation Strategy" to "Default", then it automatically generates an ObjectContext.

0
source

All Articles