CompiledWorkflowDefinitionContext.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 / Workflow / Runtime / CompiledWorkflowDefinitionContext.cs / 1305376 / CompiledWorkflowDefinitionContext.cs

                            //------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------
namespace System.Workflow.Runtime
{ 
    using System.Workflow.ComponentModel;
    using System.Workflow.ComponentModel.Compiler; 
    using System.ServiceModel; 
    using System.ServiceModel.Description;
 
    class CompiledWorkflowDefinitionContext : WorkflowDefinitionContext
    {
        static Type activityType = typeof(Activity);
        Activity rootActivity; 

        Type workflowType; 
 
        internal CompiledWorkflowDefinitionContext(Type workflowType)
        { 
            if (workflowType == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("workflowType");
            } 

            if (!activityType.IsAssignableFrom(workflowType)) 
            { 
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("workflowType", SR2.GetString(SR2.NotAnActivityType));
            } 

            this.workflowType = workflowType;
        }
 
        public override string ConfigurationName
        { 
            get 
            {
                return this.workflowType.FullName; 
            }
        }

        public override string WorkflowName 
        {
            get 
            { 
                return NamingHelper.XmlName(this.workflowType.Name);
            } 
        }

        public override WorkflowInstance CreateWorkflow()
        { 
            return this.CreateWorkflow(Guid.NewGuid());
        } 
 
        public override WorkflowInstance CreateWorkflow(Guid instanceId)
        { 
            return base.WorkflowRuntime.CreateWorkflow(this.workflowType, null, instanceId);
        }

        public override Activity GetWorkflowDefinition() 
        {
            if (rootActivity == null) 
            { 
                rootActivity = (Activity) Activator.CreateInstance(workflowType);
            } 

            return rootActivity;
        }
 
        protected override void OnRegister()
        { 
 
        }
 
        protected override void OnValidate(ValidationErrorCollection errors)
        {

        } 
    }
} 

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