Attribute of any entity type

Vote:
 

Is it possible to add an attribute which can hold a reference to any type of framework entity? Or is there some other neat way to connect any content to any other content? What I want to accomplish is the possibility to create a new blog post, forum post, instant message or anything else and attach an other entity to say "Hey, look at this image/video/blog/whatever".

#32184
Aug 25, 2009 13:00
Vote:
 

No, the specific type in the attribute definition is necessary to be able to load the object again.

What happens when you add complex types (IEntity classes) as attribute values is that only a reference to the entity ID is stored. This ID together with the type from the attribute definitoin is used later to load the object.

 

You could however, for instance, add a string attribute and an int attribute and then store a string representation of the type as well as the ID of the entity as separate attributes and then use the EntityProvider system to load the actual entity.

Eg EPiServer.Common.Data.EntityProviderHandler.GetEntityProvider(theType).GetEntityInstance(theType, theId)

 

#32192
Edited, Aug 25, 2009 14:43
Vote:
 
Great idea, thank you!
#32204
Aug 25, 2009 17:46
This thread is locked and should be used for reference only. Please use the Legacy add-ons 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.