WorkflowOperationBehavior.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 / NetFx35 / System.WorkflowServices / System / ServiceModel / Description / WorkflowOperationBehavior.cs / 1305376 / WorkflowOperationBehavior.cs

                            //------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------
namespace System.ServiceModel.Description
{ 
    using System.ServiceModel.Dispatcher;
    using System.ServiceModel.Channels; 
    using System.ServiceModel.Administration; 

    class WorkflowOperationBehavior : IOperationBehavior, IWmiInstanceProvider 
    {
        bool canCreateInstance = true;
        ServiceAuthorizationManager serviceAuthorizationManager;
 
        public bool CanCreateInstance
        { 
            get 
            {
                return this.canCreateInstance; 
            }
            set
            {
                this.canCreateInstance = value; 
            }
        } 
 
        public ServiceAuthorizationManager ServiceAuthorizationManager
        { 
            get
            {
                return this.serviceAuthorizationManager;
            } 
            set
            { 
                this.serviceAuthorizationManager = value; 
            }
        } 

        public void AddBindingParameters(OperationDescription description, BindingParameterCollection parameters)
        {
 
        }
 
        public void ApplyClientBehavior(OperationDescription description, ClientOperation proxy) 
        {
 
        }

        public void ApplyDispatchBehavior(OperationDescription description, DispatchOperation dispatch)
        { 
            if (description == null)
            { 
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("description"); 
            }
            if (dispatch == null) 
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("dispatch");
            }
            if (dispatch.Parent == null 
                || dispatch.Parent.ChannelDispatcher == null
                || dispatch.Parent.ChannelDispatcher.Host == null 
                || dispatch.Parent.ChannelDispatcher.Host.Description == null 
                || dispatch.Parent.ChannelDispatcher.Host.Description.Behaviors == null)
            { 
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.DispatchOperationInInvalidState)));
            }

            WorkflowRuntimeBehavior workflowRuntimeBehavior = dispatch.Parent.ChannelDispatcher.Host.Description.Behaviors.Find(); 

            if (workflowRuntimeBehavior == null) 
            { 
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.NoWorkflowRuntimeBehavior)));
            } 

            dispatch.Invoker = new WorkflowOperationInvoker(description, this, workflowRuntimeBehavior.WorkflowRuntime, dispatch.Parent);
        }
 
        void IWmiInstanceProvider.FillInstance(IWmiInstance wmiInstance)
        { 
            wmiInstance.SetProperty("CanCreateInstance", this.CanCreateInstance); 
        }
 
        string IWmiInstanceProvider.GetInstanceType()
        {
            return "WorkflowOperationBehavior";
        } 

        public void Validate(OperationDescription description) 
        { 

        } 
    }
}

// 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