-->
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.  [ 10 posts ] 
Author Message
 Post subject: Internal and proxy. How does it work?
PostPosted: Wed Apr 25, 2007 7:57 am 
Regular
Regular

Joined: Tue Jan 03, 2006 11:43 am
Posts: 51
Location: Sweden
What happens if I have a proxied object that hasn't yet been fetched and call an internal method on it from another object?

It feels as if NHibernate should have no way of intercepting this, since the proxy is a subclass generated outside the assembly. Or how is it working?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 27, 2007 3:11 am 
Regular
Regular

Joined: Tue Jan 03, 2006 11:43 am
Posts: 51
Location: Sweden
Anyone? Would be nice to know if I should avoid to use internal methods.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 27, 2007 4:01 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
I normally use "protected internal" and everything works fine...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 27, 2007 4:19 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
On .NET 2.0 it is possible to grant access to your domain assembly from the dynamically-generated proxy assemblies using InternalsVisibleTo attribute. You'd have to look this up in the Castle.DynamicProxy documentation since I don't remember the exact details.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 27, 2007 4:36 am 
Regular
Regular

Joined: Tue Jan 03, 2006 11:43 am
Posts: 51
Location: Sweden
It seems as if there is no exception thrown when using internal without virtual with NHibernate. Can't this be a source to bugs?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 27, 2007 4:41 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Yes, it probably can. Added a JIRA issue to improve the validator, http://jira.nhibernate.org/browse/NH-988.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 27, 2007 4:55 am 
Regular
Regular

Joined: Tue Jan 03, 2006 11:43 am
Posts: 51
Location: Sweden
So, for proxying to work correctly with internals, I would need to add InternalVisibleTo("nameOfGeneratedAssembly") to my assembly?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 27, 2007 5:16 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Quoting myself...

sergey wrote:
You'd have to look this up in the Castle.DynamicProxy documentation since I don't remember the exact details.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 27, 2007 5:41 am 
Regular
Regular

Joined: Tue Jan 03, 2006 11:43 am
Posts: 51
Location: Sweden
Sorry, should have said that I didn't find much documentation at all. Checked http://wiki.castleproject.org/index.php ... umentation and looked through the items there (API didn't work for me). If anyone else finds anything please post here.

If it is the case that it is required to have InternalsVisibleTo it should probably be added to the documentation to NHibernate.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 09, 2007 9:35 am 
Regular
Regular

Joined: Tue Jan 03, 2006 11:43 am
Posts: 51
Location: Sweden
I'm bumping this since I haven't yet found an answer to whether or not InternalsVisibleTo must be used.

I posted a topic on the DynamicProxy forum a week ago, but I have got no answers yet.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 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.