Cast BlockProxy to Block


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?

Edited, Jan 24, 2019 16:13

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

Feb 15, 2019 14:20

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.

Mar 21, 2019 6:29

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

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.