I have a .NET C# WebAPI program and I'm using an external library I need to dispose just before the main application quits.
That's my startup
function:
public class Startup
{
private static void WebApiSetup(IAppBuilder app)
{
using (var configuration = new HttpConfiguration())
{
app.UseWebApi(configuration);
}
}
}
The external library is a static class so I just have to call MyLib.DeInit();
. Unfortunately I don't see any suitable place to call that function, there's no "here we quit" function to customize. Someone is talking about registering a callback to a "cancellation token" but I don't know how to do it