ObjectContext vs. dbContext in Entity Framework 4.1



Possible Duplicate:
ADO.NET DbContext Generator vs. ADO.NET Poco Entity Generator (ObjectContext)

Either ObjectContext or DbContext should I use? What approach is ideal?

5/23/2017 11:58:33 AM

Accepted Answer

There is no difference between the two generators in terms of clean generation of POCO entities. The same entities are produced by both generators, although ADO.NET POCO Entity Generator is based onObjectContext while ADO.NET's APIDbContext Based on, the generatorDbContext 's API.

Although the API for DbContext is somewhat simpler and contains a few really great additional capabilities (such as Local and Query on Navigation Property), it seems that several functions utilized in the ObjectContext API are missing from the DbContext API (or at least it has not been explored enough yet).

EF 4.1 RC has been made live. Because the API won't change in RTW, you may use it to create a genuine application (only bugs will be fixed). Additionally, RTW is expected to happen within the next month, therefore I believe your application won't be ready by the time the final version is released.

ObjectContext API orDbContext API? ObjectContext API coverage is considerably better in the docs and blogs. There are many instances of it available. Additionally, its shortcomings are already widely recognized.DbContext API is a recent update. Mostly due of the code-first methodology, this version shows great promise. There are still just a few blog pieces, no books, and not enough proof of the API. So it depends on if you're willing to deal with the new API. if it doesn't,ObjectContext You don't need the code-first methodology, thus API is still a viable option.

4/27/2015 6:49:59 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow