Modify Recycle bin items

Recycle bin items are created using the relevant IRecycleBinService methods that occur every time a MoveToRecycleBin data event is raised from the item's manager.
Start with implementing your custom recycle bin adapter:

Then, here are two ways to modify this default behavior.

Register custom IRecycleBinItemAdapters

All Recycle bin Item factories that implement DataItemRecycleBinFactory use a list of IRecycleBinItemAdapters to populate the desired properties of a RecycleBinDataItem. Each adapter casts the specified IDataItem to the required type and transfers some of its properties to the resulting RecycleBinDataItem.
To change the existing implementation of a specific adapter, you must first find the adapter that is responsible for the specific data item type and then register an inheriting adapter type:

Implement custom Recycle bin factory

Another way to add or alter information in a Recycle bin item about a deleted data item is to implement and register a custom IRecycleBinItemFactory for populating the properties of every Recycle bin item created using the IRecycleBinService.

You implement the factory and then register the type. After this registration, every time a Recycle bin item is created from the IRecycleBinService, the specified MyCustomPageNodeRecycleBinFactory is used.

To implement the MyCustomPageNodeRecycleBinFactory class, you inherit the existing PageNodeRecycleBinFactory overriding its GetRecycleBinItemAdapters() method to add your own adapter(s):

Register the factory

To register a custom Recycle bin item factory, you must create a named registration in the ObjectFactory using the name of the manager that is responsible for the data items used to populate the Recycle bin item:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?