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:

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?