0

I am using EF with proxy and lazy load enabled. But for some process I need to get the actual non proxy classes. I have used "proxy.GetType();" etc. But all in vain. Can you please help me to get the non proxy classes?

Thanks..

Code:

  public virtual Type GetRealType(object proxy)
        {
           return proxy.GetType();
        }
Nikhil Vasdev
  • 183
  • 1
  • 3
  • 14

1 Answers1

0

You can get that type out of your Context class:

public virtual Type GetRealType(object proxy)
{
    return MyContext.GetObjectType(proxy.GetType());
} 

Other info about proxy types: http://msdn.microsoft.com/en-GB/data/jj592886.aspx

Michał Krzemiński
  • 1,261
  • 8
  • 10