-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: How do I get underlying runtime type for initialized proxy?
PostPosted: Fri Dec 30, 2005 3:01 pm 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:1.0.1

Is there a way to get the runtime type that a proxy instance represents? All I seem to be able to get using .GetType() is the proxy's type - even once I've initialized the proxy. I need to be able to get the name of the underlying type...

Is there a way to do this?

Cheers,

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 01, 2006 11:18 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
NHibernateUtil.GetClass(object proxy). This will cause the proxy to be initialized.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 01, 2006 12:29 pm 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
Thanks sergey,

I'll give that a go.

Cheers,

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 10, 2006 2:10 pm 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
Is there a way to get the proxy's underlying type without initializing the proxy? I need to get the underlying type in NHibernate.IInterceptor.OnLoad(). If I call NHibernateUtil.GetClass() and it initializes the proxy, then all proxies are defeated ...

Actually, I only need the underlying type name, not an actual instance of the type ...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 10, 2006 2:25 pm 
Expert
Expert

Joined: Fri May 13, 2005 11:13 am
Posts: 292
Location: Rochester, NY
If you know you are working with a proxy, you could try .GetType().BaseType


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.