How to delete an IActiveContent item from a database?

Topics: Developer Forum
Nov 21, 2008 at 8:23 AM
Given: ContentItem descendant implements IActiveContent interface (this allows to delegate basic CRUD operations to a content item itself). In a said content item i'd like to take some steps before deletion and than trigger a base ContentItem behavior for it. However, it turns out not to be so easy. Just calling N2.Context.Persister.Delete(this) inside IActiveContent.Delete(..) leads to an uncontrolled recursion, hence: a stack overflow. Is there any hacks OR workarounds to delete such items anyway?
Nov 21, 2008 at 5:10 PM
What is it you want to use in the persister? I'm in the process of tweaking this and would like the use case. The interface stemmed from the file system implementation that doesn't use the database at all.

Could you use persister.repository instead? It goes straighter to the database.