WorkflowFormatterBehavior.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Activities / System / ServiceModel / Activities / Description / WorkflowFormatterBehavior.cs / 1305376 / WorkflowFormatterBehavior.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.ServiceModel.Activities.Description 
{
    using System.Collections.ObjectModel; 
    using System.Runtime; 
    using System.ServiceModel.Activities;
    using System.ServiceModel.Channels; 
    using System.ServiceModel.Description;
    using System.ServiceModel.Dispatcher;

    class WorkflowFormatterBehavior : IOperationBehavior 
    {
        IDispatchMessageFormatter formatter; 
        IDispatchFaultFormatter faultFormatter; 
        Collection receives;
 
        public Collection Receives
        {
            get
            { 
                if (this.receives == null)
                { 
                    this.receives = new Collection(); 
                }
                return this.receives; 
            }
        }

        public void ApplyClientBehavior(OperationDescription operationDescription, System.ServiceModel.Dispatcher.ClientOperation clientOperation) 
        {
            throw FxTrace.Exception.AsError(new NotImplementedException()); 
        } 

        public void ApplyDispatchBehavior(OperationDescription operationDescription, DispatchOperation dispatchOperation) 
        {
            Fx.Assert(operationDescription != null, "OperationDescription cannot be null!");
            Fx.Assert(dispatchOperation != null, "DispatchOperation cannot be null!");
 
            if (dispatchOperation.Formatter == null)
            { 
                return; 
            }
 
            this.formatter = dispatchOperation.Formatter;
            this.faultFormatter = dispatchOperation.FaultFormatter;
            if (this.receives != null)
            { 
                foreach (Receive receive in this.receives)
                { 
                    receive.SetFormatter(this.formatter, this.faultFormatter, dispatchOperation.IncludeExceptionDetailInFaults); 
                }
            } 

            // Remove operation formatter from dispatch runtime
            dispatchOperation.Formatter = null;
            dispatchOperation.DeserializeRequest = false; 
            dispatchOperation.SerializeReply = false;
        } 
 
        public void AddBindingParameters(OperationDescription operationDescription, BindingParameterCollection bindingParameters)
        { 
        }

        public void Validate(OperationDescription operationDescription)
        { 
        }
    } 
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK