I was wondering if anyone has attempted to lazy load a subclass (where is isn’t known what the subclass is until the result is returned) using EF and POCOs?
This is a bit of a nightmare in NHibernate, but works as long as you don’t attempt to cast the returned result to a subclass (because a proxy of the base class is created, it can’t be cast).
If you are talking about casting a property to a specific derived type or a specific interface implementation, no, it cannot be done, and IMHO it shouldn’t be done. If a property is supposed to return an implementation of a specific interface, then you should communicate with it through that interface. Casting is usually a sign you are doing something wrong.
Otherwise properties are lazy loaded on access without problems (if they are configured to lazy load).