Cast BlockProxy to Block

Vote:
 

HI! I am trying to somehow get MyBlock class instance from PropertyData.

I have tried:

propertyData.Value as MyBlock;

ProxyUtil.GetUnproxiedInstance( propertyData.Value);

((IProxyTargetAccessor) propertyData.Value).DynProxyGetTarget();

((MyBlock)propertyData.Value).CreateWritableClone ( );

They all return MyBlockProxy!

ProxyUtil.GetUnproxiedType ( propertyData.Value ); gives the correct type (MyBlock)

Is there a way to do this?

#200782
Edited, Jan 24, 2019 16:13
Vote:
 

What is the actual value of your propertyData.Value.  The actual value?

#201353
Feb 15, 2019 14:20
Vote:
 

Hi Wojciech

This is by design. You define the class MyBlock in code, but you get an instance of MyBlockProxy. Same goes for page types.

#202248
Mar 21, 2019 6:29
Vote:
 

MyBlockProxy is a dynamic generated class inherited from MyBlock, you can just use the MyBlockProxy  instance as a MyBlock instance, as Stefan said

#202249
Mar 21, 2019 7:38
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.