Access to built-in Properties of BlockData?

Vote:
 

Hi folks,

I'm trying to access to built-in properties of BlockData such as CreatedBy, Created however Its seem no easy way to achieve it, casting to BlockData, IContent, IContentData did not help, I can see them when debugging but they are belong to Proxy type at runtime. Does any one know how to achieve it? 

Any help would be very appriciated!

#66212
Feb 25, 2013 4:08
Vote:
 

Doing reflection can solve the problem but I dont want to use reflection.

#66213
Feb 25, 2013 5:54
Vote:
 

Hi,

You'll have to cast to the interface which defines the properties, ie IChangeTrackable, IVersionable etc. Note that you may want to begin by checking if the block is IContent in case the block is a "local" block which won't implement those interfaces.

Given that the block is a shared block you can have a look at what interfaces the ContentMixin class and its base class BasicContent implements. All of those interfaces will be implemented by your shared block as well.

#66215
Feb 25, 2013 8:42
Vote:
 

Thank you Joel!

It sounds make sense, I'll give it a try. 

 

ps: I'm enjoy reading your blog. 

 

#66224
Feb 25, 2013 10:25
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.