コード例 #1
0
ファイル: SqlCommand.cs プロジェクト: zgramana/mono
        internal void ValidateAsyncResult(IAsyncResult ar, string endMethod)
        {
            if (ar == null)
            {
                throw new ArgumentException("result passed is null!");
            }
            if (!(ar is SqlAsyncResult))
            {
                throw new ArgumentException(String.Format("cannot test validity of types {0}",
                                                          ar.GetType()));
            }
            SqlAsyncResult result = (SqlAsyncResult)ar;

            if (result.EndMethod != endMethod)
            {
                throw new InvalidOperationException(String.Format("Mismatched {0} called for AsyncResult. " +
                                                                  "Expected call to {1} but {0} is called instead.",
                                                                  endMethod, result.EndMethod));
            }
            if (result.Ended)
            {
                throw new InvalidOperationException(String.Format("The method {0} cannot be called " +
                                                                  "more than once for the same AsyncResult.", endMethod));
            }
        }
コード例 #2
0
ファイル: SqlCommand.cs プロジェクト: zgramana/mono
        internal void EndExecuteInternal(IAsyncResult ar)
        {
            SqlAsyncResult sqlResult = ((SqlAsyncResult)ar);

            Connection.Tds.WaitFor(sqlResult.InternalResult);
            Connection.Tds.CheckAndThrowException(sqlResult.InternalResult);
        }
コード例 #3
0
ファイル: SqlCommand.cs プロジェクト: zgramana/mono
        public IAsyncResult BeginExecuteNonQuery(AsyncCallback callback, object stateObject)
        {
            ValidateCommand("BeginExecuteNonQuery", true);
            SqlAsyncResult ar = new SqlAsyncResult(callback, stateObject);

            ar.EndMethod      = "EndExecuteNonQuery";
            ar.InternalResult = BeginExecuteInternal(CommandBehavior.Default, false, ar.BubbleCallback, ar);
            return(ar);
        }
コード例 #4
0
ファイル: SqlCommand.cs プロジェクト: zgramana/mono
        public IAsyncResult BeginExecuteXmlReader(AsyncCallback callback, object stateObject)
        {
            ValidateCommand("BeginExecuteXmlReader", true);
            SqlAsyncResult ar = new SqlAsyncResult(callback, stateObject);

            ar.EndMethod      = "EndExecuteXmlReader";
            ar.InternalResult = BeginExecuteInternal(behavior, true,
                                                     ar.BubbleCallback, stateObject);
            return(ar);
        }
コード例 #5
0
        public IAsyncResult BeginExecuteReader(AsyncCallback callback, object state, CommandBehavior behavior)
        {
            ValidateCommand("BeginExecuteReader");
            this.behavior = behavior;
            SqlAsyncResult ar = new SqlAsyncResult(callback, state);

            ar.EndMethod = "EndExecuteReader";
            IAsyncResult tdsResult = BeginExecuteInternal(behavior, true,
                                                          ar.BubbleCallback, state);

            ar.InternalResult = tdsResult;
            return(ar);
        }
コード例 #6
0
ファイル: SqlCommand.cs プロジェクト: nlhepler/mono
		public IAsyncResult BeginExecuteXmlReader (AsyncCallback callback, object stateObject)
		{
			ValidateCommand ("BeginExecuteXmlReader", true);
			SqlAsyncResult ar = new SqlAsyncResult (callback, stateObject);
			ar.EndMethod = "EndExecuteXmlReader";
			ar.InternalResult = BeginExecuteInternal (behavior, true, 
				ar.BubbleCallback, stateObject);
			return ar;
		}
コード例 #7
0
ファイル: SqlCommand.cs プロジェクト: nlhepler/mono
		public IAsyncResult BeginExecuteReader (AsyncCallback callback, object stateObject, CommandBehavior behavior)
		{
			ValidateCommand ("BeginExecuteReader", true);
			this.behavior = behavior;
			SqlAsyncResult ar = new SqlAsyncResult (callback, stateObject);
			ar.EndMethod = "EndExecuteReader";
			IAsyncResult tdsResult = BeginExecuteInternal (behavior, true, 
				ar.BubbleCallback, stateObject);
			ar.InternalResult = tdsResult;
			return ar;
		}
コード例 #8
0
ファイル: SqlCommand.cs プロジェクト: nlhepler/mono
		public IAsyncResult BeginExecuteNonQuery (AsyncCallback callback, object stateObject)
		{
			ValidateCommand ("BeginExecuteNonQuery", true);
			SqlAsyncResult ar = new SqlAsyncResult (callback, stateObject);
			ar.EndMethod = "EndExecuteNonQuery";
			ar.InternalResult = BeginExecuteInternal (CommandBehavior.Default, false, ar.BubbleCallback, ar);
			return ar;
		}