SoftDelete

The SoftDelete module manages two version spaces of Normal and Deleted.  It intercepts deletion operations and converts them into moving the deleted item into the Deleted space.  This provides archiving and potential retrieval of deleted items, and it is a required module for any other versioning system which can transfer content changes between versions, as otherwise there is no way to transfer a deletion change as no data will exist.  When switching version to Deleted, you can see the archived deleted records and you are shown a 'Reinstate' button on the CMS bar which will allow you to 'undelete' the item.

Setting up the SoftDelete module

The SoftDelete module requires the IsDeleted flag to be added to the ContentItems table.  This can be done with the script at /Areas/Lynicon.Base/Admin/SQL/SoftDeleteInit.sql.

Configuring the SoftDelete module

.UseModule<SoftDelete>((Func<Type, bool>)(t => !(new Type[] { typeof(User), typeof(Cafe), typeof(AlternateUrlsContent) }.Contains(t))))

The SoftDelete model has one parameter on intialisation as shown above, this is the applyToType parameter which is a function from type to bool which is true for any content type on which the module should provide soft deletion functionality.

Ensuring a content type is soft deleted

A content type is soft deleted if and only if its container type implements ISoftDeleteable