I'm playing around with Durable WCF services. i.e. WCF services that persist their state (in my case to a sql server database) between method calls.
I would like to be able to use durable components like this in either Workflow operations or with Asp.Net applications or both.
I understand how to set these components up, have them persist their data, and how to get them to remove their persistence. Where I'm hung up on, though, is how can I ensure that they always properly remove their persistence information from the Sql Server database.
For example, let's say that I connect to a Durable WCF component from an Asp.Net application. I can put its context into session and then reconstitute it from anywhere within my app. I can catch Session_End in the Global.asax file and tell the component its no longer needed.
Except - what about when Session_End doesn't fire properly (for whatever reason)?
Say I want to use the same Durable component for other stuff outside of Asp.Net where there's not a session and where the state may need to stick around for days or weeks at a time between calls.
Is there already a standard way of clearing out persistence information when it's no longer needed? How can you tell for sure if it's no longer needed? What would you suggest?