2

Possible Duplicate:
ObjectSet.Context vs DbSet

From a DbSet in EF code first, is there a way to refer to the parent DbContext? On the ObjectSet, there is an ObjectContext property. Does something like this exist for the DbSet, or some other means to get the context?

Community
  • 1
  • 1
Brian Mains
  • 50,520
  • 35
  • 148
  • 257
  • I am interested in understanding the scenario here. Can you elaborate a bit more why you need it? – Pawel Mar 23 '12 at 22:53
  • It's part of my architecture; I created some architecture around the ObjectSet, and I was going to do the same with the DbSet. – Brian Mains Mar 23 '12 at 23:26

1 Answers1

3

I've done some digging; internally, it does keep track of this association, through an array of internal objects. So it's not public, and therefore best to pass the DbContext with the DbSet as another parameter.

Brian Mains
  • 50,520
  • 35
  • 148
  • 257