ReFocus
ReFocus

Reputation: 1521

EntityFramework 4.3 - Creating DbContext from Database without ObjectContext?

Following the tutorial on http://msdn.microsoft.com/en-us/data/gg715119 it describes adding an EDMX Entity Data Model to my solution (which generates cluttered models including ObjectContext from my db) and after that the tutorial generates a DbContext by clicking "Add item..." on the EDMX designer (because this is where the option Generate DbContext is available).

Is this the way to go if I want to work with EF 4.3 DbContext? Isn't it possible somehow to create a model from my database while only using DbContext?

I don't really want the ObjectContext with EDMX file in my solution. Just the .tt files. Is this possible?

Upvotes: 0

Views: 3997

Answers (1)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364389

If you want to use DbContext (or any other template) you have to first turn off default code generation which produces ObjectContext - in EDMX property window remove custom tool for code generation.

Upvotes: 2

Related Questions