Just got my hands on the 3.0 e-book and was happy to find that the ReleaseProxy() has been implemented since we implemented our own channel.
Can I make a request that the ReleaseProxy() implement something like the the below snippet so that it automatically releases the connections in our custom proxy? Another idea is to have IDataPortalProxy implement IDisposable?
If mPortal IsNot Nothing ThenDim o As Object = mPortal
Dim dispType As System.Type = o.GetType().GetInterface("System.IDisposable")
If dispType IsNot Nothing Then
CType(o, IDisposable).Dispose()
End If
End If
Thanks.
This is a good idea.
I don't think having IDataPortalProxy implement IDisposable is a good idea, because that would imply that proxies should somehow be disposed in normal usage - and that's not practical in most apps. Typically the proxy is created and cached during the entire life of the AppDomain.
But this release method is an exception to that, and you are right that the proxy should be disposed when it is released.
Copyright (c) Marimer LLC