I need to spot EF POCO proxies; MSDN gives some hints based around ObjectContext.GetObjectType(type.GetType())
However, I would really like to do this without the EF reference. For example, with NHibernate, I can check whether the object implements a marker interface, using the name (as a string) "NHibernate.Proxy.INHibernateProxy".
Is there anything similar in EF POCO proxies? For example can I rely on them being in the namespace System.Data.Entity.DynamicProxies., or is that brittle?
Taking a peek inside reflector, it simply checks the assembly against internally tracked assemblies, which is problematic for me.
Checking under-the-hood, as an implementation detail it is indeed the case that in the current EF the type will always live in “System.Data.Entity.DynamicProxies”. This probably isn’t a robust test, but should change infrequently. I will attempt to clarify this with Microsoft, though.