Exemple #1
0
            internal SerializeBodyContentsAsyncResult(OperationFormatter operationFormatter, XmlDictionaryWriter writer, MessageVersion version, object[] parameters,
                                                      object returnValue, bool isRequest, AsyncCallback callback, object state)
                : base(callback, state)
            {
                bool completeSelf = true;

                MessageDescription messageDescription;
                StreamFormatter    streamFormatter;

                operationFormatter.SetupStreamAndMessageDescription(isRequest, out streamFormatter, out messageDescription);

                if (streamFormatter != null)
                {
                    _streamFormatter = streamFormatter;
                    IAsyncResult result = streamFormatter.BeginSerialize(writer, parameters, returnValue, PrepareAsyncCompletion(s_handleEndSerializeBodyContents), this);
                    completeSelf = SyncContinue(result);
                }
                else
                {
                    operationFormatter.SerializeBody(writer, version, operationFormatter.RequestAction, messageDescription, returnValue, parameters, isRequest);
                    completeSelf = true;
                }


                if (completeSelf)
                {
                    Complete(true);
                }
            }