예제 #1
0
        /// <summary>
        /// Invoked to execute the associated command and returns the integer produced by that
        /// execution.
        /// </summary>
        protected override int OnExecute()
        {
            if (IsDisposed)
            {
                throw new ObjectDisposedException(this.ToString());
            }
            if (Command.IsDisposed)
            {
                throw new ObjectDisposedException(Command.ToString());
            }
            if (Command.Link.IsDisposed)
            {
                throw new ObjectDisposedException(Command.Link.ToString());
            }

            SurrogateDirect surrogate = null;
            int             result    = 0;

            try
            {
                surrogate = new SurrogateDirect(Command);
                result    = surrogate.OnExecuteScalar();
            }
            finally
            {
                if (surrogate != null)
                {
                    try { surrogate.Dispose(); }
                    catch { }
                }
            }

            return(result);
        }
예제 #2
0
		/// <summary>
		/// Invoked to execute the associated command and returns the integer produced by that
		/// execution.
		/// </summary>
		protected override int OnExecute()
		{
			if (IsDisposed) throw new ObjectDisposedException(this.ToString());
			if (Command.IsDisposed) throw new ObjectDisposedException(Command.ToString());
			if (Command.Link.IsDisposed) throw new ObjectDisposedException(Command.Link.ToString());

			SurrogateDirect surrogate = null;
			int result = 0;

			try
			{
				surrogate = new SurrogateDirect(Command);
				result = surrogate.OnExecuteScalar();
			}
			finally
			{
				if (surrogate != null)
				{
					try { surrogate.Dispose(); }
					catch { }
				}
			}

			return result;
		}
예제 #3
0
 /// <summary>
 /// Invoked when disposing or finalizing this instance.
 /// </summary>
 /// <param name="disposing">True if the object is being disposed, false otherwise.</param>
 protected override void OnDispose(bool disposing)
 {
     if (disposing)
     {
         try { if (_Surrogate != null && !_Surrogate.IsDisposed)
               {
                   _Surrogate.Dispose();
               }
         }
         catch { }
     }
     base.OnDispose(disposing);
 }