/// <summary> /// Prepares the connection before it is exposed. /// The default implementation applies ExceptionListener and client id. /// Can be overridden in subclasses. /// </summary> /// <param name="con">The Connection to prepare.</param> /// <exception cref="EMSException">if thrown by any EMS API methods.</exception> protected virtual void PrepareConnection(IConnection con) { if (ClientId != null) { con.ClientID = ClientId; } if (this.exceptionListener != null || this.reconnectOnException) { IExceptionListener listenerToUse = this.exceptionListener; if (reconnectOnException) { listenerToUse = new InternalChainedExceptionListener(this, listenerToUse); } con.ExceptionListener = listenerToUse; } }