ObjectSet.Context vs DbSet

I used ObjectSetin EF 4.0, I could get a basic Context for this ObjectSetusing

myObjectSet.Contextwhich returns ObjectContext.

Now with DbSetin Ef4.1, what is equivalent?

+5
source share
1 answer

EF 4.1 does not offer a public API to retrieve DbContextfrom an instance DbSet. You will need to use the Reflections API to get the instance DbContext.

Edit

DbContext DbSet. , , DbSet. DbContext instace .

public MyService(DbContext context, DbSet<MyClass> mySet){}

EntityFramewrk.dll Reflector , DbContext instace / DbSet. , .

+3

All Articles