AppProperties
, found in Microsoft.Owin.BuilderProperties
, exposes the CancellationToken
for OnAppDisposing
.
You can get this token and register a callback to it
public class Startup
{
public void Configuration(IAppBuilder app)
{
var properties = new AppProperties(app.Properties);
CancellationToken token = properties.OnAppDisposing;
if (token != CancellationToken.None)
{
token.Register(() =>
{
// do stuff
});
}
}
}