1

Possible Duplicate:
ObjectContext vs DbContext

The author of this answer wrote that https://stackoverflow.com/a/12494339/1662812 "Both T4 and DbContext API are currently recommended approach for using EF"

I still wonder what exactly is the difference between DbContext API and ObjectContext API when used with Entity Data Model and I am also looking for any reference about DbContext API being recommended approach for using EF.

1
  • Object Context will be cut from Entity Framework 7. Commented Mar 15, 2015 at 1:35

2 Answers 2

3

"DbContext is much simpler to use than ObjectContext and will serve the most common development needs. if you need more, you can drop down into the ObjectContext.

Remember that DbContext sits on top of the ObjectContext. The ObjectContext is always there in the background doing it’s work. So if you need to do something very granular, DbContext provides a hook to its underlying ObjectContext." from http://thedatafarm.com/blog/data-access/code-first-and-dbcontext-are-now-ldquo-the-entity-framework-rdquo/. She is in EF team, also has good video about that on Pluralsight.

From my point of view, DbContext is easier to use, and covers almost everything you need. I always make an extension method for exposing object context (methods from it) if I need them somewhere.

Sign up to request clarification or add additional context in comments.

Comments

1

I think Julie Lermann is the source for that

http://msdn.microsoft.com/en-us/magazine/hh781018.aspx

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.