fsprojects/FSharp.TypeProviders.StarterPack — pull request #23 by ReedCopsey (2014-06-20 17:56:31+00:00)
Title: Added Disposing event

Added a Disposing event to the TypeProviderForNamespaces type. This
allows type providers that require their own resource management to hook
into the IDisposable.Dispose call.

I used an event here instead of following the traditional dispose pattern with reason-

I didn't want to add a `public Dispose(bool)` method on the type (for fear that it'd add confusion and people would call it), even though that was closed to the traditional Dispose pattern. The traditional pattern is not possible in F#, since you can't control access to the method (ie: no protected member). Using a Disposing event is something that has been done in the framework, as well (ie: Control.Disposing). This also allows type providers which have externally controlled resources (such as the FileSystem TP) to manage disposal correctly.