What's the difference between DbContext and ObjectContext

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.

For better information, who better to look to than Julie Lerman for more info on the differences, as was brought into EF 4.1.


the DbContext is a smaller API exposing the most commonly used features of the ObjectContext. In some cases, those features are mirrored in the DbContext API. In other cases, the Entity Framework team has simplified more complex coding by providing us with methods like Find or properties like DbSet.Local. But there’s a big API lurking underneath that you may still need access to. For example, you might want to work directly with the MetadataWorkspace to write generic code against classes because that API can read the model more efficiently than reflection. Additionally, the MetadataWorkspace is able to provide more information about the metadata than you can discover with reflection, for example, for Key properties. Or you might want to take advantage of a database-specific function that is exposed through Entity SQL, which you can’t access from LINQ to Entities. Or you may already have an application written using the ObjectContext and you want to leverage the DbContext in future updates without replacing all of the ObjectContext code.(Reference from Programming DbContext)