jjarrel
08-01-2007, 03:59 AM
I am applying DebugInterceptor example to learn more about the autoproxy feature.
I have been able to successfully apply the DebugInterceptor using the ProxyFactory in code. Now I want to try and do it with an autoproxy configuration.
It seems easy enough but I get an invalid cast exception.
Any advice?
Thanks,
jeff
System.InvalidCastException: Unable to cast object of type 'CompositionAopProxy_34cf5a029be14c439e4d8755fb96c 726' to type 'PW3Info.baseelement.data.BaseElement'.
BaseElement myBaseElement = (BaseElement) Globals.Factory.GetObject("myBaseElement");
<object name="myBaseElement"
type="PW3Info.baseelement.data.BaseElement, PW3Info">
<property name="ElementName" value="StoreID" />
<property name="Description" value="The Store Identifier" />
</object>
<object id="debugInterceptor" type="PW3Info.aop.DebugInterceptor, PW3Info">
</object>
<object id="ProxyCreator" type="Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxy Creator, Spring.Aop">
<property name="ObjectNames">
<list>
<value>myBaseElement</value>
</list>
</property>
<property name="InterceptorNames">
<list>
<value>debugInterceptor</value>
</list>
</property>
</object>
I have been able to successfully apply the DebugInterceptor using the ProxyFactory in code. Now I want to try and do it with an autoproxy configuration.
It seems easy enough but I get an invalid cast exception.
Any advice?
Thanks,
jeff
System.InvalidCastException: Unable to cast object of type 'CompositionAopProxy_34cf5a029be14c439e4d8755fb96c 726' to type 'PW3Info.baseelement.data.BaseElement'.
BaseElement myBaseElement = (BaseElement) Globals.Factory.GetObject("myBaseElement");
<object name="myBaseElement"
type="PW3Info.baseelement.data.BaseElement, PW3Info">
<property name="ElementName" value="StoreID" />
<property name="Description" value="The Store Identifier" />
</object>
<object id="debugInterceptor" type="PW3Info.aop.DebugInterceptor, PW3Info">
</object>
<object id="ProxyCreator" type="Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxy Creator, Spring.Aop">
<property name="ObjectNames">
<list>
<value>myBaseElement</value>
</list>
</property>
<property name="InterceptorNames">
<list>
<value>debugInterceptor</value>
</list>
</property>
</object>