in aspnet/Microsoft.Samples.XMLA.HTTP/Microsoft.Samples.XMLA.HTTP.Proxy/ConnectionPool.cs [14:32]
public ConnectionPoolEntry(AdomdConnection con, string connectionString)
{
this.Connection = con;
this.ConnectionString = connectionString;
//the combindation of the strong reference to the connection
//and this delegate ties the reachability of the ConnectionPoolEntry and the AdomdConnection together
//so they are guaranteed to become unreachable at the same time
//This would enable the ConnectionPool to keep a WeakReference to the ConnectionPoolEntry without
//keeping the AdomdConnection alive, but also not worry about the ConnectionPoolEntry being GCd
//while the AdomdConnection is still alive.
con.Disposed += (s, a) =>
{
this.IsDisposed = true;
con = null;
};
}