All,

I'm using proxies based on an interface, e.g.

  <class name="Thing"
         proxy="Domains.Interfaces.IThing, Domains.Interfaces"
         table="Thing"
         discriminator-value="0">

When I do a Session.Load (or anything that creates a proxy) then the
proxy is based on the interface, IThing. Any code such as this:

Thing obj = (Thing)proxy;

will fail as an "IThing" proxy from NHibernate does not inherit from
"Thing".So far so good, I understand this.

If I then do the following:

Thing obj = null;
if (NHibernateUtil.IsInitialized(proxy))
{
   NHibernateUtil.Initialize(proxy)
}
obj = (Thing)proxy;


then the cast will still fail as proxy is STILL a NHibernate proxy and
not the concrete type of "Thing". This is although NH has gone to the
DB, got the data and NHibernateUtil.IsInitialized(proxy) will return
true.

How do I force NH to convert a proxy (from an interface) to a concrete
type? Even a Get will return a proxy as the object still exists in
Session.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to