Exemplo n.º 1
0
        internal void OnInfoMessage(UnsafeNativeMethods.IErrorInfo errorInfo, OleDbHResult errorCode)
        {
            OleDbInfoMessageEventHandler handler = (OleDbInfoMessageEventHandler)Events[EventInfoMessage];

            if (null != handler)
            {
                try
                {
                    OleDbException            exception = OleDbException.CreateException(errorInfo, errorCode, null);
                    OleDbInfoMessageEventArgs e         = new OleDbInfoMessageEventArgs(exception);
                    handler(this, e);
                }
                catch (Exception e)
                { // eat the exception
                    // UNDONE - should not be catching all exceptions!!!
                    if (!ADP.IsCatchableOrSecurityExceptionType(e))
                    {
                        throw;
                    }

                    ADP.TraceExceptionWithoutRethrow(e);
                }
            }
#if DEBUG
            else
            {
                OleDbException exception = OleDbException.CreateException(errorInfo, errorCode, null);
            }
#endif
        }
        internal void OnInfoMessage(UnsafeNativeMethods.IErrorInfo errorInfo, OleDbHResult errorCode)
        {
            OleDbInfoMessageEventHandler handler = (OleDbInfoMessageEventHandler)Events[EventInfoMessage];

            if (null != handler)
            {
                try {
                    OleDbException            exception = OleDbException.CreateException(errorInfo, errorCode, null);
                    OleDbInfoMessageEventArgs e         = new OleDbInfoMessageEventArgs(exception);
                    if (Bid.TraceOn)
                    {
                        Bid.Trace("<oledb.OledbConnection.OnInfoMessage|API|INFO> %d#, Message='%ls'\n", ObjectID, e.Message);
                    }
                    handler(this, e);
                }
                catch (Exception e) { // eat the exception
                    //
                    if (!ADP.IsCatchableOrSecurityExceptionType(e))
                    {
                        throw;
                    }

                    ADP.TraceExceptionWithoutRethrow(e);
                }
            }
#if DEBUG
            else
            {
                OleDbException exception = OleDbException.CreateException(errorInfo, errorCode, null);
                Bid.Trace("<oledb.OledbConnection.OnInfoMessage|API|INFO> %d#, Message='%ls'\n", ObjectID, exception.Message);
            }
#endif
        }
Exemplo n.º 3
0
        internal void OnInfoMessage(System.Data.Common.UnsafeNativeMethods.IErrorInfo errorInfo, OleDbHResult errorCode)
        {
            OleDbInfoMessageEventHandler handler = (OleDbInfoMessageEventHandler)base.Events[EventInfoMessage];

            if (handler != null)
            {
                try
                {
                    OleDbInfoMessageEventArgs e = new OleDbInfoMessageEventArgs(OleDbException.CreateException(errorInfo, errorCode, null));
                    if (Bid.TraceOn)
                    {
                        Bid.Trace("<oledb.OledbConnection.OnInfoMessage|API|INFO> %d#, Message='%ls'\n", this.ObjectID, e.Message);
                    }
                    handler(this, e);
                }
                catch (Exception exception)
                {
                    if (!ADP.IsCatchableOrSecurityExceptionType(exception))
                    {
                        throw;
                    }
                    ADP.TraceExceptionWithoutRethrow(exception);
                }
            }
        }
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// oledbinfomessageeventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this OleDbInfoMessageEventHandler oledbinfomessageeventhandler, Object sender, OleDbInfoMessageEventArgs e, AsyncCallback callback)
        {
            if (oledbinfomessageeventhandler == null)
            {
                throw new ArgumentNullException("oledbinfomessageeventhandler");
            }

            return(oledbinfomessageeventhandler.BeginInvoke(sender, e, callback, null));
        }