Exemplo n.º 1
0
            static void LoadComplete(IAsyncResult result)
            {
                if (result.CompletedSynchronously)
                {
                    return;
                }

                Fx.Assert(result.AsyncState is StartOperationAsyncResult,
                          "Should have been passed a StartOperationAsyncResult as the state");

                StartOperationAsyncResult startResult = (StartOperationAsyncResult)result.AsyncState;
                Exception        completionException  = null;
                OperationContext oldOperationContext  = OperationContext.Current;

                OperationContext.Current = startResult.operationContext;

                try
                {
                    try
                    {
                        startResult.durableInstance.instance = startResult.durableInstance.provider.EndLoad(result);

                        Fx.Assert(startResult.durableInstance.instance != null,
                                  "The instance should always be set here.");

                        startResult.scope.Complete();
                    }
                    catch (Exception e)
                    {
                        if (Fx.IsFatal(e))
                        {
                            throw;
                        }

                        completionException = e;
                    }
                    finally
                    {
                        startResult.scope.Dispose();
                    }

                    startResult.Complete(false, completionException);
                }
                finally
                {
                    OperationContext.Current = oldOperationContext;
                }
            }
Exemplo n.º 2
0
            public static object End(IAsyncResult result)
            {
                StartOperationAsyncResult startResult = AsyncResult.End <StartOperationAsyncResult>(result);

                return(startResult.durableInstance.instance);
            }
Exemplo n.º 3
0
 public object EndStartOperation(IAsyncResult result)
 {
     return(StartOperationAsyncResult.End(result));
 }