Ejemplo n.º 1
0
 // callback handler that executes when call completes
 public void MyEndExecuteCallback(IAsyncResult async)
 {
     try
     {
         // obtain the results from the accessor
         DataAccessor <TResultTable> accessor = async.AsyncState as DataAccessor <TResultTable>;
         result         = accessor.EndExecute(async).ToList();
         executionState = true;
     }
     catch
     {
         // handle any execution completion errors here
     }
 }
Ejemplo n.º 2
0
        // callback handler that executes when call completes
        public void MyEndExecuteCallback(IAsyncResult async)
        {
            try
            {
                // obtain the results from the accessor
                DataAccessor <TResultTable> accessor =
                    async.AsyncState as DataAccessor <TResultTable>;

                if (accessor != null)
                {
                    result = accessor.EndExecute(async).ToList();
                }
            }
            catch
            {
                throw new Exception("Asyn operation has failed in method  MyEndExecuteCallback(IAsyncResult async)");
            }
        }
        public void EndExecuteAccessor <T>(IAsyncResult result)
        {
            DaabAsyncResult daabResult = (DaabAsyncResult)result;
            DbAsyncState    state      = (DbAsyncState)daabResult.AsyncState;

            try
            {
                DataAccessor <T> accessor = (DataAccessor <T>)state.Accessor;
                state.State = accessor.EndExecute(result);
            }
            catch (Exception e)
            {
                state.Exception = e;
            }
            finally
            {
                state.AutoResetEvent.Set();
            }
        }
Ejemplo n.º 4
0
 public void ThenEndExecuteReturnsResultsAsEnumerable()
 {
     Assert.IsNotNull(accessor.EndExecute(asyncResult));
 }