Example #1
0
 public override void Destroy()
 {
     lock (_connectionMonitor)
     {
         if (Connection != null)
         {
             Connection.Destroy();
             Connection = null;
         }
     }
 }
Example #2
0
        public override IConnection CreateConnection()
        {
            lock (_connectionMonitor)
            {
                if (Connection == null)
                {
                    var target = DoCreateConnection();
                    Connection = new SharedConnectionProxy(this, target);

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

            return(Connection);
        }
 /// <summary>
 /// Close the underlying shared connection.
 /// </summary>
 public override void Dispose()
 {
     lock (this.connectionMonitor)
     {
         if (this.connection != null)
         {
             this.connection.Dispose();
             this.connection = null;
         }
     }
 }
        /// <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;
        }