-->
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.  [ 1 post ] 
Author Message
 Post subject: Problems with proxies
PostPosted: Mon Feb 26, 2007 1:43 pm 
Newbie

Joined: Thu Apr 27, 2006 6:03 am
Posts: 14
Hello!

We are still using 1.0.2 and want to proxy our classes. Because of generic methods in our base class and the incompatibility of DynamicProxy and generic methods we implemented interface proxies. As access strategy we are using a custom accessor derived by IPropertyAccessor.

In the mapping files we declared the interface to use as the proxy interface for the classes.

Now we run into two problems:

1. Having a superclass (Super) and two derived subclasses (SubA, SubB) and using the type Super as association in another class, we have the problem that we cannot distinguish from which sub type the proxy is. Checking the object’s type with the is operator returns always true. (obj is SubA == true and obj is SubB == true).

2. If SubA and SubB have properties with the same name, we get a System.Reflection.TargetException: Object does not match target type. It seems that it is by pure chance accessing the property of the accessed type. The reason is that all derived interfaces are aggregated within the proxy, isn’t it?

So, is this behaviour unavoidable and the only possibility is not to use the is operator and to define unique names for properties and methods in a hierarchy?


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

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.