示例#1
0
 /// <summary>
 /// Close the underlying shared connection.
 /// </summary>
 public override void Dispose()
 {
     lock (this.connectionMonitor)
     {
         if (this.connection != null)
         {
             this.connection.Dispose();
             this.connection = null;
         }
     }
 }
示例#2
0
        /// <summary>
        /// Create a connection.
        /// </summary>
        /// <returns>The connection.</returns>
        public override IConnection CreateConnection()
        {
            lock (this.connectionMonitor)
            {
                if (this.connection == null)
                {
                    var target = this.DoCreateConnection();
                    this.connection = new SharedConnectionProxy(target, this);

                    // invoke the listener *after* this.connection is assigned
                    this.ConnectionListener.OnCreate(target);
                }
            }

            return(this.connection);
        }