-->
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: NH-988 why?
PostPosted: Fri May 04, 2007 6:25 pm 
Newbie

Joined: Thu Jan 04, 2007 3:56 pm
Posts: 11
Hi,

I'd like to understand the point of not allowing internal fields and if possible a proposed alternative.

The background: I'm injecting dependencies through some internal fields and the IInterceptor, but fields cannot be virtual. Must I always create a virtual setter method? Is there a pattern advising against doing it this way? Is there a better way to do it?

http://jira.nhibernate.org/browse/NH-988

Thanks
Cristian


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 05, 2007 1:52 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
It's the same as with public fields - if you access them directly and the object is a proxy, you will never get correct values, not even after the object is initialized.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 05, 2007 1:08 pm 
Regular
Regular

Joined: Wed Apr 25, 2007 4:18 am
Posts: 51
Location: Belarus, Gomel
BTW current implementation of ProxyTypeValidator is incomplete - it handle just one "special case" - Object.GetType, but there are more if one will inherit persistent classes from MarshalByRefObject...
At least this members cause errors:
IsInstanceOfType, GetComIUnknown, CanCastToXmlType, InvokeMember, __RaceSetServerIdentity and __ResetServerIdentity

_________________
WBR, Igor


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 05, 2007 1:14 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
We can of course modify the proxy validator to take this into account, but why are you inheriting persistent objects from MarshalByRefObject? It seems to me a strange thing to do. And are you sure that the methods you mentioned will behave correctly for proxies?


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 07, 2007 5:09 am 
Regular
Regular

Joined: Wed Apr 25, 2007 4:18 am
Posts: 51
Location: Belarus, Gomel
Thank you for quick reply, I'l try to convince colleagues that they really don't have to pass references to persistent objects via remoting.
BTW I don't know (and have no time and knowledge to make test) if .NET proxy will work with DynamicProxy, I personally don't use remoting in this case.

_________________
WBR, Igor


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.