示例#1
0
 protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
 {
     WebUtil.CheckArgumentNull <XmlDictionaryWriter>(writer, "writer");
     try
     {
         writer.WriteStartElement("Binary");
         using (XmlWriterStream stream = new XmlWriterStream(writer))
         {
             this.writerAction(stream);
         }
         writer.WriteEndElement();
     }
     finally
     {
         if (this.service != null)
         {
             this.service.DisposeDataSource();
             HttpContextServiceHost httpContextServiceHost = this.service.OperationContext.Host.HttpContextServiceHost;
             if ((httpContextServiceHost != null) && httpContextServiceHost.ErrorFound)
             {
                 OperationContext current = OperationContext.Current;
                 if (current != null)
                 {
                     current.Channel.Abort();
                 }
             }
         }
     }
 }
示例#2
0
 protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
 {
     WebUtil.CheckArgumentNull<XmlDictionaryWriter>(writer, "writer");
     try
     {
         writer.WriteStartElement("Binary");
         using (XmlWriterStream stream = new XmlWriterStream(writer))
         {
             this.writerAction(stream);
         }
         writer.WriteEndElement();
     }
     finally
     {
         if (this.service != null)
         {
             this.service.DisposeDataSource();
             HttpContextServiceHost httpContextServiceHost = this.service.OperationContext.Host.HttpContextServiceHost;
             if ((httpContextServiceHost != null) && httpContextServiceHost.ErrorFound)
             {
                 OperationContext current = OperationContext.Current;
                 if (current != null)
                 {
                     current.Channel.Abort();
                 }
             }
         }
     }
 }
示例#3
0
        /// <summary>Called when the message body is written to an XML file.</summary>
        /// <param name="writer">
        /// An <see cref="XmlDictionaryWriter"/> that is used to write this 
        /// message body to an XML file.
        /// </param>
        protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
        {
            WebUtil.CheckArgumentNull(writer, "writer");

            try
            {
                writer.WriteStartElement(XmlConstants.WcfBinaryElementName);
                using (XmlWriterStream stream = new XmlWriterStream(writer))
                {
                    this.writerAction(stream);
                }

                writer.WriteEndElement();
            }
            finally
            {
                if (this.service != null)
                {
                    HttpContextServiceHost host = this.service.OperationContext.RequestMessage.HttpContextServiceHost;

                    this.service.DisposeDataSource();
                    if (host != null)
                    {
                        if (host.ErrorFound)
                        {
                            var ctx = System.ServiceModel.OperationContext.Current;
                            if (ctx != null)
                            {
                                ctx.Channel.Abort();
                            }
                        }
                    }
                }
            }
        }
示例#4
0
        /// <summary>Called when the message body is written to an XML file.</summary>
        /// <param name="writer">
        /// An <see cref="XmlDictionaryWriter"/> that is used to write this
        /// message body to an XML file.
        /// </param>
        protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
        {
            WebUtil.CheckArgumentNull(writer, "writer");

            try
            {
                writer.WriteStartElement(XmlConstants.WcfBinaryElementName);
                using (XmlWriterStream stream = new XmlWriterStream(writer))
                {
                    this.writerAction(stream);
                }

                writer.WriteEndElement();
            }
            finally
            {
                if (this.service != null)
                {
                    HttpContextServiceHost host = this.service.OperationContext.RequestMessage.HttpContextServiceHost;

                    this.service.DisposeDataSource();
                    if (host != null)
                    {
                        if (host.ErrorFound)
                        {
                            var ctx = System.ServiceModel.OperationContext.Current;
                            if (ctx != null)
                            {
                                ctx.Channel.Abort();
                            }
                        }
                    }
                }
            }
        }
示例#5
0
            /// <summary>Called when the message body is written to an XML file.</summary>
            /// <param name="writer">
            /// An <see cref="XmlDictionaryWriter"/> that is used to write this
            /// message body to an XML file.
            /// </param>
            protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
            {
                Debug.Assert(writer != null, "writer != null");

                try
                {
                    writer.WriteStartElement(ServiceUtils.WcfBinaryElementName);
                    using (XmlWriterStream stream = new XmlWriterStream(writer))
                    {
                        this.writerAction(stream);
                    }

                    writer.WriteEndElement();
                }
                finally
                {
                    // We will always abort the channel in case a domain service exception occurs.
                    var ctx = System.ServiceModel.OperationContext.Current;
                    if (ctx != null)
                    {
                        ctx.Channel.Abort();
                    }
                }
            }
            /// <summary>Called when the message body is written to an XML file.</summary>
            /// <param name="writer">
            /// An <see cref="XmlDictionaryWriter"/> that is used to write this 
            /// message body to an XML file.
            /// </param>
            protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
            {
                Debug.Assert(writer != null, "writer != null");

                try
                {
                    writer.WriteStartElement(ServiceUtils.WcfBinaryElementName);
                    using (XmlWriterStream stream = new XmlWriterStream(writer))
                    {
                        this.writerAction(stream);
                    }

                    writer.WriteEndElement();
                }
                finally
                {
                    // We will always abort the channel in case a domain service exception occurs.
                    var ctx = System.ServiceModel.OperationContext.Current;
                    if (ctx != null)
                    {
                        ctx.Channel.Abort();
                    }
                }
            }