We have a large EF 4.0 data framework (based on ObjectContext, EntitySet, EntityObject and ObjectStateManager) which was developed with DB-first in mind. Given that one can obtain an ObjectContext from a DbContext, could we use our existing framework with a code-first DbContext just by using IObjectContextAdapter?
I know that DbContext uses POCOs (and not EntityObject descendants), but those POCOs are internally proxy objects of type Proxy<TPOCO>. Do those proxies inherit or provide access to underlying EntityObject and is there an underlying EntityObject at all?
Yes, you can use
DbContextby casting toIObjectContextAdapterand accessingObjectContextwhere needed.DbContextitself is happy with any class, you can use POCOs without Entity Framework creating proxies. If you use proxy objects, it’s just objects derived from your POCO objects. Nothing more, nothing else. Hence there’s noEntityObject.