Entity Framework
What is the difference between DataContext and ObjectContext?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Oct 17, 2016, 5:26 AM EDT
DbContextis just a wrapper aroundObjectContextDbContextis just a set of APIs that are easier to use than the APIs exposed byObjectContextAnyway here there is a very simple VS Template that uses Repository Pattern and EF
Pravin MoreRank #1,419 · 1.2K reputationPosted Oct 17, 2016, 11:49 PM EDT
Ervis Trupja154 reputationPosted Oct 25, 2016, 3:51 AM EDT
accepted
DbContext is a lightweight version of the ObjectContext class, which is laid almost right on top of ObjectContext (there is even a way to get to the ObjectContext from just the DbContext). It's also a lot easier to use, IMO, and makes CRUD operations a sinch.
Prakash KumarRank #1,799 · 828 reputationPosted Oct 30, 2016, 10:43 PM EDT