How to completely delete a content?

Topics: Customizing Orchard
Nov 23, 2014 at 1:32 PM
When I add a new page, the database table Orchard_Framework_ContentItemVersionRecord will insert a new record.
When I modify the page, the table will insert a new record and the old record still remain.
When I delete the page, the record only set the Published and Latest field to false.

By the Version Manager module, I can select which version will be shown. But I still can't delete a history page.

Then I download the source code. I find there's only a Remove method and have no Delete method. So, does it means I can't completely delete a content in Orchard?

Sometimes, somebody really need completely delete some important data. How could I do?

Thanks for any help.
Nov 23, 2014 at 5:40 PM
The 1.x branch contains a RecycleBin class (in Orchard.AuditTrail) that let's you permanently delete items.
We decided to not expose this functionality through the UI because of its destructive nature.
Marked as answer by HappyCoder79 on 11/23/2014 at 7:04 PM
Nov 24, 2014 at 2:04 AM
Thank you very much!
Nov 24, 2014 at 1:20 PM
you can use a content handler
  public class MyPartHandler: ContentHandler
            public MyPartHandler(IRepository<MyPartRecord> repo)
        OnRemoved<MyPart>((context, part) => repo.Delete(part.Record)); //This is so item is deleted from database 
Nov 24, 2014 at 5:41 PM
That will only delete the record from the table where that specific part record is stored. To delete all records of the parts attached to the content item, you will have to do so manually. That will work, but not unless you have generic code that performs this task on every part attached, since a user could have attached more parts through the dashboard. The RecycleBin class does this automatically for you.