I need to find out if an object with a particular primary key is already attached to a DataContext and get the entity from the DataContext if it is attached. Is there any way at all to do this that doesn't require Reflection with full trust?
Ideally, I would like to call GetCachedObject(), but I'd have to use reflection to get at that, and I'm pretty sure I'd have to be in full trust mode, which won't work in a hosted environment.
I'm open to thinking outside the box here. Also, I can fully control the generated LinqToSql code, so that's not a problem either. I can rewrite my DataContext class. Is there any way to get access to the IdentityManager, replace the IdentityManager with my own abstraction, etc? Any and all ideas are welcome.