public virtual XmlQualifiedName GetXmlQualifiedName(Type type, out string prefix)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            string typeNamespace = type.Namespace ?? String.Empty;
            string assemblyName  = (type.Assembly != null && type.Assembly != this.localAssembly) ? type.Assembly.FullName : String.Empty;

            int key = typeNamespace.GetHashCode() ^ assemblyName.GetHashCode();

            if (!this.clrNamespaceBasedMappings.TryGetValue(key, out WorkflowMarkupSerializerMapping mappingForType))
            {
                WorkflowMarkupSerializerMapping.GetMappingFromType(this, type, out mappingForType, out IList <WorkflowMarkupSerializerMapping> collectedMappings);
                AddMappings(new List <WorkflowMarkupSerializerMapping>(new WorkflowMarkupSerializerMapping[] { mappingForType }));
                AddMappings(collectedMappings);
            }

            string typeName = WorkflowMarkupSerializer.EnsureMarkupExtensionTypeName(type);

            //Make sure that while writting the workflow namespaces will always be the default
            prefix = (mappingForType.Prefix.Equals(StandardXomlKeys.WorkflowPrefix, StringComparison.Ordinal)) ? String.Empty : mappingForType.Prefix;
            return(new XmlQualifiedName(typeName, mappingForType.XmlNamespace));
        }
        public override bool Equals(object value)
        {
            WorkflowMarkupSerializerMapping mapping = value as WorkflowMarkupSerializerMapping;

            if (mapping == null)
            {
                return(false);
            }
            return(((this.clrns == mapping.clrns) && (this.targetAssemblyName == mapping.targetAssemblyName)) && (this.unifiedAssemblyName == mapping.unifiedAssemblyName));
        }
        static WorkflowMarkupSerializerMapping()
        {
            WorkflowMarkupSerializerMapping.wellKnownTypes = new Dictionary <string, Type>();
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(ThrowActivity).Name, typeof(ThrowActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(ThrowDesigner).Name, typeof(ThrowDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(SuspendActivity).Name, typeof(SuspendActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(SuspendDesigner).Name, typeof(SuspendDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(CancellationHandlerActivity).Name, typeof(CancellationHandlerActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(CancellationHandlerActivityDesigner).Name, typeof(CancellationHandlerActivityDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(CompensateActivity).Name, typeof(CompensateActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(CompensateDesigner).Name, typeof(CompensateDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(CompensationHandlerActivity).Name, typeof(CompensationHandlerActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(CompensationHandlerActivityDesigner).Name, typeof(CompensationHandlerActivityDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(FaultHandlerActivity).Name, typeof(FaultHandlerActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(FaultHandlerActivityDesigner).Name, typeof(FaultHandlerActivityDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(FaultHandlersActivity).Name, typeof(FaultHandlersActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(FaultHandlersActivityDesigner).Name, typeof(FaultHandlersActivityDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(SynchronizationScopeActivity).Name, typeof(SynchronizationScopeActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(SequenceDesigner).Name, typeof(SequenceDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(TransactionScopeActivity).Name, typeof(TransactionScopeActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(TransactionScopeActivityDesigner).Name, typeof(TransactionScopeActivityDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(PropertySegment).Name, typeof(PropertySegment));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(CompensatableTransactionScopeActivity).Name, typeof(CompensatableTransactionScopeActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(ActivityDesigner).Name, typeof(ActivityDesigner));


            //I am hard coding the well known mappings here instead of going through the assemblies as we want the mappings to be in
            //a specific order for performance optimization when searching for type
            WorkflowMarkupSerializerMapping.wellKnownMappings = new List <WorkflowMarkupSerializerMapping>();

            WorkflowMarkupSerializerMapping.Activities = new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Activities", AssemblyRef.ActivitiesAssemblyRef);
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(WorkflowMarkupSerializerMapping.Activities);

            WorkflowMarkupSerializerMapping.ComponentModel = new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.ComponentModel", Assembly.GetExecutingAssembly().FullName);
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(WorkflowMarkupSerializerMapping.ComponentModel);

            WorkflowMarkupSerializerMapping.Serialization = new WorkflowMarkupSerializerMapping(StandardXomlKeys.Definitions_XmlNs_Prefix, StandardXomlKeys.Definitions_XmlNs, "System.Workflow.ComponentModel.Serialization", Assembly.GetExecutingAssembly().FullName);
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(WorkflowMarkupSerializerMapping.Serialization);

            WorkflowMarkupSerializerMapping.Rules = new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Activities.Rules", AssemblyRef.ActivitiesAssemblyRef);
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(WorkflowMarkupSerializerMapping.Rules);

            WorkflowMarkupSerializerMapping.ComponentModelDesign = new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.ComponentModel.Design", Assembly.GetExecutingAssembly().FullName);
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(WorkflowMarkupSerializerMapping.ComponentModelDesign);

            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Runtime", AssemblyRef.RuntimeAssemblyRef));
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.ComponentModel.Compiler", Assembly.GetExecutingAssembly().FullName));

            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Activities.Rules.Design", AssemblyRef.ActivitiesAssemblyRef));
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Runtime.Configuration", AssemblyRef.RuntimeAssemblyRef));
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Runtime.Hosting", AssemblyRef.RuntimeAssemblyRef));
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Runtime.Tracking", AssemblyRef.RuntimeAssemblyRef));
        }
        static WorkflowMarkupSerializerMapping()
        {
            WorkflowMarkupSerializerMapping.wellKnownTypes = new Dictionary<string, Type>();
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(ThrowActivity).Name, typeof(ThrowActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(ThrowDesigner).Name, typeof(ThrowDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(SuspendActivity).Name, typeof(SuspendActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(SuspendDesigner).Name, typeof(SuspendDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(CancellationHandlerActivity).Name, typeof(CancellationHandlerActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(CancellationHandlerActivityDesigner).Name, typeof(CancellationHandlerActivityDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(CompensateActivity).Name, typeof(CompensateActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(CompensateDesigner).Name, typeof(CompensateDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(CompensationHandlerActivity).Name, typeof(CompensationHandlerActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(CompensationHandlerActivityDesigner).Name, typeof(CompensationHandlerActivityDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(FaultHandlerActivity).Name, typeof(FaultHandlerActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(FaultHandlerActivityDesigner).Name, typeof(FaultHandlerActivityDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(FaultHandlersActivity).Name, typeof(FaultHandlersActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(FaultHandlersActivityDesigner).Name, typeof(FaultHandlersActivityDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(SynchronizationScopeActivity).Name, typeof(SynchronizationScopeActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(SequenceDesigner).Name, typeof(SequenceDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(TransactionScopeActivity).Name, typeof(TransactionScopeActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(TransactionScopeActivityDesigner).Name, typeof(TransactionScopeActivityDesigner));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(PropertySegment).Name, typeof(PropertySegment));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(CompensatableTransactionScopeActivity).Name, typeof(CompensatableTransactionScopeActivity));
            WorkflowMarkupSerializerMapping.wellKnownTypes.Add(typeof(ActivityDesigner).Name, typeof(ActivityDesigner));


            //I am hard coding the well known mappings here instead of going through the assemblies as we want the mappings to be in
            //a specific order for performance optimization when searching for type
            WorkflowMarkupSerializerMapping.wellKnownMappings = new List<WorkflowMarkupSerializerMapping>();

            WorkflowMarkupSerializerMapping.Activities = new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Activities", AssemblyRef.ActivitiesAssemblyRef);
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(WorkflowMarkupSerializerMapping.Activities);

            WorkflowMarkupSerializerMapping.ComponentModel = new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.ComponentModel", Assembly.GetExecutingAssembly().FullName);
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(WorkflowMarkupSerializerMapping.ComponentModel);

            WorkflowMarkupSerializerMapping.Serialization = new WorkflowMarkupSerializerMapping(StandardXomlKeys.Definitions_XmlNs_Prefix, StandardXomlKeys.Definitions_XmlNs, "System.Workflow.ComponentModel.Serialization", Assembly.GetExecutingAssembly().FullName);
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(WorkflowMarkupSerializerMapping.Serialization);

            WorkflowMarkupSerializerMapping.Rules = new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Activities.Rules", AssemblyRef.ActivitiesAssemblyRef);
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(WorkflowMarkupSerializerMapping.Rules);

            WorkflowMarkupSerializerMapping.ComponentModelDesign = new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.ComponentModel.Design", Assembly.GetExecutingAssembly().FullName);
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(WorkflowMarkupSerializerMapping.ComponentModelDesign);

            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Runtime", AssemblyRef.RuntimeAssemblyRef));
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.ComponentModel.Compiler", Assembly.GetExecutingAssembly().FullName));

            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Activities.Rules.Design", AssemblyRef.ActivitiesAssemblyRef));
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Runtime.Configuration", AssemblyRef.RuntimeAssemblyRef));
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Runtime.Hosting", AssemblyRef.RuntimeAssemblyRef));
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Runtime.Tracking", AssemblyRef.RuntimeAssemblyRef));
        }
        static WorkflowMarkupSerializerMapping()
        {
            WorkflowMarkupSerializerMapping.wellKnownTypes = new Dictionary <string, Type>();

            //I am hard coding the well known mappings here instead of going through the assemblies as we want the mappings to be in
            //a specific order for performance optimization when searching for type
            WorkflowMarkupSerializerMapping.wellKnownMappings = new List <WorkflowMarkupSerializerMapping>();

            WorkflowMarkupSerializerMapping.Serialization = new WorkflowMarkupSerializerMapping(StandardXomlKeys.Definitions_XmlNs_Prefix, StandardXomlKeys.Definitions_XmlNs, "System.Workflow.ComponentModel.Serialization", Assembly.GetExecutingAssembly().FullName);
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(WorkflowMarkupSerializerMapping.Serialization);

            WorkflowMarkupSerializerMapping.Rules = new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Activities.Rules", AssemblyRef.ActivitiesAssemblyRef);
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(WorkflowMarkupSerializerMapping.Rules);

            //Possibly need this to work with a designer.
            WorkflowMarkupSerializerMapping.wellKnownMappings.Add(new WorkflowMarkupSerializerMapping(StandardXomlKeys.WorkflowPrefix, StandardXomlKeys.WorkflowXmlNs, "System.Workflow.Activities.Rules.Design", AssemblyRef.DialogAssemblyRef));
        }
 static WorkflowMarkupSerializerMapping()
 {
     wellKnownTypes.Add(typeof(ThrowActivity).Name, typeof(ThrowActivity));
     wellKnownTypes.Add(typeof(ThrowDesigner).Name, typeof(ThrowDesigner));
     wellKnownTypes.Add(typeof(SuspendActivity).Name, typeof(SuspendActivity));
     wellKnownTypes.Add(typeof(SuspendDesigner).Name, typeof(SuspendDesigner));
     wellKnownTypes.Add(typeof(CancellationHandlerActivity).Name, typeof(CancellationHandlerActivity));
     wellKnownTypes.Add(typeof(CancellationHandlerActivityDesigner).Name, typeof(CancellationHandlerActivityDesigner));
     wellKnownTypes.Add(typeof(CompensateActivity).Name, typeof(CompensateActivity));
     wellKnownTypes.Add(typeof(CompensateDesigner).Name, typeof(CompensateDesigner));
     wellKnownTypes.Add(typeof(CompensationHandlerActivity).Name, typeof(CompensationHandlerActivity));
     wellKnownTypes.Add(typeof(CompensationHandlerActivityDesigner).Name, typeof(CompensationHandlerActivityDesigner));
     wellKnownTypes.Add(typeof(FaultHandlerActivity).Name, typeof(FaultHandlerActivity));
     wellKnownTypes.Add(typeof(FaultHandlerActivityDesigner).Name, typeof(FaultHandlerActivityDesigner));
     wellKnownTypes.Add(typeof(FaultHandlersActivity).Name, typeof(FaultHandlersActivity));
     wellKnownTypes.Add(typeof(FaultHandlersActivityDesigner).Name, typeof(FaultHandlersActivityDesigner));
     wellKnownTypes.Add(typeof(SynchronizationScopeActivity).Name, typeof(SynchronizationScopeActivity));
     wellKnownTypes.Add(typeof(SequenceDesigner).Name, typeof(SequenceDesigner));
     wellKnownTypes.Add(typeof(TransactionScopeActivity).Name, typeof(TransactionScopeActivity));
     wellKnownTypes.Add(typeof(TransactionScopeActivityDesigner).Name, typeof(TransactionScopeActivityDesigner));
     wellKnownTypes.Add(typeof(PropertySegment).Name, typeof(PropertySegment));
     wellKnownTypes.Add(typeof(CompensatableTransactionScopeActivity).Name, typeof(CompensatableTransactionScopeActivity));
     wellKnownTypes.Add(typeof(ActivityDesigner).Name, typeof(ActivityDesigner));
     wellKnownMappings = new List <WorkflowMarkupSerializerMapping>();
     Activities        = new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Activities", "System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
     wellKnownMappings.Add(Activities);
     ComponentModel = new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.ComponentModel", Assembly.GetExecutingAssembly().FullName);
     wellKnownMappings.Add(ComponentModel);
     Serialization = new WorkflowMarkupSerializerMapping("x", "http://schemas.microsoft.com/winfx/2006/xaml", "System.Workflow.ComponentModel.Serialization", Assembly.GetExecutingAssembly().FullName);
     wellKnownMappings.Add(Serialization);
     Rules = new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Activities.Rules", "System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
     wellKnownMappings.Add(Rules);
     ComponentModelDesign = new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.ComponentModel.Design", Assembly.GetExecutingAssembly().FullName);
     wellKnownMappings.Add(ComponentModelDesign);
     wellKnownMappings.Add(new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Runtime", "System.Workflow.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL"));
     wellKnownMappings.Add(new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.ComponentModel.Compiler", Assembly.GetExecutingAssembly().FullName));
     wellKnownMappings.Add(new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Activities.Rules.Design", "System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"));
     wellKnownMappings.Add(new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Runtime.Configuration", "System.Workflow.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL"));
     wellKnownMappings.Add(new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Runtime.Hosting", "System.Workflow.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL"));
     wellKnownMappings.Add(new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Runtime.Tracking", "System.Workflow.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL"));
 }
 static WorkflowMarkupSerializerMapping()
 {
     wellKnownTypes.Add(typeof(ThrowActivity).Name, typeof(ThrowActivity));
     wellKnownTypes.Add(typeof(ThrowDesigner).Name, typeof(ThrowDesigner));
     wellKnownTypes.Add(typeof(SuspendActivity).Name, typeof(SuspendActivity));
     wellKnownTypes.Add(typeof(SuspendDesigner).Name, typeof(SuspendDesigner));
     wellKnownTypes.Add(typeof(CancellationHandlerActivity).Name, typeof(CancellationHandlerActivity));
     wellKnownTypes.Add(typeof(CancellationHandlerActivityDesigner).Name, typeof(CancellationHandlerActivityDesigner));
     wellKnownTypes.Add(typeof(CompensateActivity).Name, typeof(CompensateActivity));
     wellKnownTypes.Add(typeof(CompensateDesigner).Name, typeof(CompensateDesigner));
     wellKnownTypes.Add(typeof(CompensationHandlerActivity).Name, typeof(CompensationHandlerActivity));
     wellKnownTypes.Add(typeof(CompensationHandlerActivityDesigner).Name, typeof(CompensationHandlerActivityDesigner));
     wellKnownTypes.Add(typeof(FaultHandlerActivity).Name, typeof(FaultHandlerActivity));
     wellKnownTypes.Add(typeof(FaultHandlerActivityDesigner).Name, typeof(FaultHandlerActivityDesigner));
     wellKnownTypes.Add(typeof(FaultHandlersActivity).Name, typeof(FaultHandlersActivity));
     wellKnownTypes.Add(typeof(FaultHandlersActivityDesigner).Name, typeof(FaultHandlersActivityDesigner));
     wellKnownTypes.Add(typeof(SynchronizationScopeActivity).Name, typeof(SynchronizationScopeActivity));
     wellKnownTypes.Add(typeof(SequenceDesigner).Name, typeof(SequenceDesigner));
     wellKnownTypes.Add(typeof(TransactionScopeActivity).Name, typeof(TransactionScopeActivity));
     wellKnownTypes.Add(typeof(TransactionScopeActivityDesigner).Name, typeof(TransactionScopeActivityDesigner));
     wellKnownTypes.Add(typeof(PropertySegment).Name, typeof(PropertySegment));
     wellKnownTypes.Add(typeof(CompensatableTransactionScopeActivity).Name, typeof(CompensatableTransactionScopeActivity));
     wellKnownTypes.Add(typeof(ActivityDesigner).Name, typeof(ActivityDesigner));
     wellKnownMappings = new List<WorkflowMarkupSerializerMapping>();
     Activities = new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Activities", "System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
     wellKnownMappings.Add(Activities);
     ComponentModel = new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.ComponentModel", Assembly.GetExecutingAssembly().FullName);
     wellKnownMappings.Add(ComponentModel);
     Serialization = new WorkflowMarkupSerializerMapping("x", "http://schemas.microsoft.com/winfx/2006/xaml", "System.Workflow.ComponentModel.Serialization", Assembly.GetExecutingAssembly().FullName);
     wellKnownMappings.Add(Serialization);
     Rules = new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Activities.Rules", "System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
     wellKnownMappings.Add(Rules);
     ComponentModelDesign = new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.ComponentModel.Design", Assembly.GetExecutingAssembly().FullName);
     wellKnownMappings.Add(ComponentModelDesign);
     wellKnownMappings.Add(new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Runtime", "System.Workflow.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL"));
     wellKnownMappings.Add(new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.ComponentModel.Compiler", Assembly.GetExecutingAssembly().FullName));
     wellKnownMappings.Add(new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Activities.Rules.Design", "System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"));
     wellKnownMappings.Add(new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Runtime.Configuration", "System.Workflow.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL"));
     wellKnownMappings.Add(new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Runtime.Hosting", "System.Workflow.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL"));
     wellKnownMappings.Add(new WorkflowMarkupSerializerMapping("wf", "http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Runtime.Tracking", "System.Workflow.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL"));
 }
        public override bool Equals(object value)
        {
            WorkflowMarkupSerializerMapping mapping = value as WorkflowMarkupSerializerMapping;

            if (mapping == null)
            {
                return(false);
            }
            //
            // This class is intended to make MT scenarios easier by holding both the target and the unified (current)
            // assembly names.  They both represent the same type in this container and thus the both need to match to be equal.
            // This makes it easier to make this classes default (static constructor) work better with MT in the rest of the codebase.
            if (this.clrns == mapping.clrns &&
                this.targetAssemblyName == mapping.targetAssemblyName &&
                this.unifiedAssemblyName == mapping.unifiedAssemblyName)
            {
                return(true);
            }

            return(false);
        }
Esempio n. 9
0
        public virtual XmlQualifiedName GetXmlQualifiedName(Type type, out string prefix)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            string str  = (type.Namespace != null) ? type.Namespace : string.Empty;
            string str2 = ((type.Assembly != null) && (type.Assembly != this.localAssembly)) ? type.Assembly.FullName : string.Empty;
            WorkflowMarkupSerializerMapping mapping = null;
            int key = str.GetHashCode() ^ str2.GetHashCode();

            if (!this.clrNamespaceBasedMappings.TryGetValue(key, out mapping))
            {
                IList <WorkflowMarkupSerializerMapping> collectedMappings = null;
                WorkflowMarkupSerializerMapping.GetMappingFromType(this, type, out mapping, out collectedMappings);
                this.AddMappings(new List <WorkflowMarkupSerializerMapping>(new WorkflowMarkupSerializerMapping[] { mapping }));
                this.AddMappings(collectedMappings);
            }
            string name = WorkflowMarkupSerializer.EnsureMarkupExtensionTypeName(type);

            prefix = mapping.Prefix.Equals("wf", StringComparison.Ordinal) ? string.Empty : mapping.Prefix;
            return(new XmlQualifiedName(name, mapping.XmlNamespace));
        }
        internal static void GetMappingFromType(WorkflowMarkupSerializationManager manager, Type type, out WorkflowMarkupSerializerMapping matchingMapping, out IList <WorkflowMarkupSerializerMapping> collectedMappings)
        {
            matchingMapping   = null;
            collectedMappings = new List <WorkflowMarkupSerializerMapping>();

            string clrNamespace = type.Namespace ?? String.Empty;
            string xmlNamespace = String.Empty;
            string assemblyName = String.Empty;
            string prefix       = String.Empty;

            assemblyName = GetAssemblyName(type, manager);

            if (type.Assembly.FullName.Equals(AssemblyRef.ActivitiesAssemblyRef, StringComparison.Ordinal))
            {
                xmlNamespace = StandardXomlKeys.WorkflowXmlNs;
                prefix       = StandardXomlKeys.WorkflowPrefix;
            }
            else if (type.Assembly.FullName.Equals(AssemblyRef.DialogAssemblyRef, StringComparison.Ordinal))
            {
                xmlNamespace = StandardXomlKeys.WorkflowXmlNs;
                prefix       = StandardXomlKeys.WorkflowPrefix;
            }
            else if (type.Assembly == Assembly.GetExecutingAssembly())
            {
                xmlNamespace = StandardXomlKeys.WorkflowXmlNs;
                prefix       = StandardXomlKeys.WorkflowPrefix;
            }

            if (xmlNamespace.Length == 0)
            {
                //First lookup the type's assembly for XmlNsDefinitionAttribute
                object[] xmlnsDefinitions = type.Assembly.GetCustomAttributes(typeof(XmlnsDefinitionAttribute), true);
                foreach (XmlnsDefinitionAttribute xmlnsDefinition in xmlnsDefinitions)
                {
                    xmlNamespace = xmlnsDefinition.XmlNamespace;
                    assemblyName = xmlnsDefinition.AssemblyName;

                    if (type.Assembly == manager.LocalAssembly)
                    {
                        assemblyName = String.Empty;
                    }
                    else if (String.IsNullOrEmpty(assemblyName))
                    {
                        assemblyName = GetAssemblyName(type, manager);
                    }

                    if (String.IsNullOrEmpty(xmlNamespace))
                    {
                        xmlNamespace = GetFormatedXmlNamespace(clrNamespace, assemblyName);
                    }
                    prefix = GetPrefix(manager, type.Assembly, xmlNamespace);

                    WorkflowMarkupSerializerMapping mapping = new WorkflowMarkupSerializerMapping(prefix, xmlNamespace, clrNamespace, assemblyName, type.Assembly.FullName);
                    if (xmlnsDefinition.ClrNamespace.Equals(clrNamespace, StringComparison.Ordinal) && matchingMapping == null)
                    {
                        matchingMapping = mapping;
                    }
                    else
                    {
                        collectedMappings.Add(mapping);
                    }
                }
            }

            if (matchingMapping == null)
            {
                if (type.Assembly == manager.LocalAssembly)
                {
                    assemblyName = String.Empty;
                }
                else if (String.IsNullOrEmpty(assemblyName))
                {
                    assemblyName = GetAssemblyName(type, manager);
                }

                xmlNamespace = GetFormatedXmlNamespace(clrNamespace, assemblyName);

                if (String.IsNullOrEmpty(prefix))
                {
                    prefix = GetPrefix(manager, type.Assembly, xmlNamespace);
                }

                matchingMapping = new WorkflowMarkupSerializerMapping(prefix, xmlNamespace, clrNamespace, assemblyName, type.Assembly.FullName);
            }
        }
        public virtual Type GetType(XmlQualifiedName xmlQualifiedName)
        {
            if (xmlQualifiedName == null)
            {
                throw new ArgumentNullException("xmlQualifiedName");
            }

            string xmlns    = xmlQualifiedName.Namespace;
            string typeName = WorkflowMarkupSerializer.EnsureMarkupExtensionTypeName(xmlQualifiedName);


            // first check our cache
            cachedXmlQualifiedNameTypes.TryGetValue(xmlQualifiedName, out Type resolvedType);

            if (resolvedType == null)
            {
                // lookup in well known types
                resolvedType = WorkflowMarkupSerializerMapping.ResolveWellKnownTypes(this, xmlns, typeName);
            }

            if (resolvedType == null)
            {
                //Lookup existing mapping
                if (!this.xmlNamespaceBasedMappings.TryGetValue(xmlns, out List <WorkflowMarkupSerializerMapping> xmlnsMappings))
                {
                    WorkflowMarkupSerializerMapping.GetMappingsFromXmlNamespace(this, xmlns, out IList <WorkflowMarkupSerializerMapping> matchingMappings, out IList <WorkflowMarkupSerializerMapping> collectedMappings);
                    AddMappings(matchingMappings);
                    AddMappings(collectedMappings);

                    xmlnsMappings = new List <WorkflowMarkupSerializerMapping>(matchingMappings);
                }

                foreach (WorkflowMarkupSerializerMapping xmlnsMapping in xmlnsMappings)
                {
                    string assemblyName = xmlnsMapping.AssemblyName;
                    string clrNamespace = xmlnsMapping.ClrNamespace;

                    // append dot net namespace name
                    string fullTypeName = xmlQualifiedName.Name;
                    if (clrNamespace.Length > 0)
                    {
                        fullTypeName = clrNamespace + "." + xmlQualifiedName.Name;
                    }

                    // Work around  for component model assembly
                    if (assemblyName.Equals(Assembly.GetExecutingAssembly().FullName, StringComparison.Ordinal))
                    {
                        resolvedType = Assembly.GetExecutingAssembly().GetType(fullTypeName);
                    }
                    else if (assemblyName.Length == 0)
                    {
                        if (this.localAssembly != null)
                        {
                            resolvedType = this.localAssembly.GetType(fullTypeName);
                        }
                    }
                    else
                    {
                        string assemblyQualifiedName = fullTypeName;
                        if (assemblyName.Length > 0)
                        {
                            assemblyQualifiedName += (", " + assemblyName);
                        }

                        // now grab the actual type
                        try
                        {
                            resolvedType = GetType(assemblyQualifiedName);
                        }
                        catch
                        {
                            //
                        }

                        if (resolvedType == null)
                        {
                            resolvedType = GetType(fullTypeName);
                            if (resolvedType != null && !resolvedType.AssemblyQualifiedName.Equals(assemblyQualifiedName, StringComparison.Ordinal))
                            {
                                resolvedType = null;
                            }
                        }
                    }

                    //We found the type
                    if (resolvedType != null)
                    {
                        cachedXmlQualifiedNameTypes[xmlQualifiedName] = resolvedType;
                        break;
                    }
                }
            }

            return(resolvedType);
        }
        internal static void GetMappingFromType(WorkflowMarkupSerializationManager manager, Type type, out WorkflowMarkupSerializerMapping matchingMapping, out IList <WorkflowMarkupSerializerMapping> collectedMappings)
        {
            matchingMapping   = null;
            collectedMappings = new List <WorkflowMarkupSerializerMapping>();
            string clrNamespace = (type.Namespace != null) ? type.Namespace : string.Empty;
            string xmlNamespace = string.Empty;
            string assemblyName = string.Empty;
            string prefix       = string.Empty;

            assemblyName = GetAssemblyName(type, manager);
            if (type.Assembly.FullName.Equals("System.Workflow.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL", StringComparison.Ordinal))
            {
                xmlNamespace = "http://schemas.microsoft.com/winfx/2006/xaml/workflow";
                prefix       = "wf";
            }
            if (type.Assembly.FullName.Equals("System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", StringComparison.Ordinal))
            {
                xmlNamespace = "http://schemas.microsoft.com/winfx/2006/xaml/workflow";
                prefix       = "wf";
            }
            else if (type.Assembly == Assembly.GetExecutingAssembly())
            {
                xmlNamespace = "http://schemas.microsoft.com/winfx/2006/xaml/workflow";
                prefix       = "wf";
            }
            if (xmlNamespace.Length == 0)
            {
                foreach (XmlnsDefinitionAttribute attribute in type.Assembly.GetCustomAttributes(typeof(XmlnsDefinitionAttribute), true))
                {
                    xmlNamespace = attribute.XmlNamespace;
                    assemblyName = attribute.AssemblyName;
                    if (type.Assembly == manager.LocalAssembly)
                    {
                        assemblyName = string.Empty;
                    }
                    else if (string.IsNullOrEmpty(assemblyName))
                    {
                        assemblyName = GetAssemblyName(type, manager);
                    }
                    if (string.IsNullOrEmpty(xmlNamespace))
                    {
                        xmlNamespace = GetFormatedXmlNamespace(clrNamespace, assemblyName);
                    }
                    prefix = GetPrefix(manager, type.Assembly, xmlNamespace);
                    WorkflowMarkupSerializerMapping item = new WorkflowMarkupSerializerMapping(prefix, xmlNamespace, clrNamespace, assemblyName, type.Assembly.FullName);
                    if (attribute.ClrNamespace.Equals(clrNamespace, StringComparison.Ordinal) && (matchingMapping == null))
                    {
                        matchingMapping = item;
                    }
                    else
                    {
                        collectedMappings.Add(item);
                    }
                }
            }
            if (matchingMapping == null)
            {
                if (type.Assembly == manager.LocalAssembly)
                {
                    assemblyName = string.Empty;
                }
                else if (string.IsNullOrEmpty(assemblyName))
                {
                    assemblyName = GetAssemblyName(type, manager);
                }
                xmlNamespace = GetFormatedXmlNamespace(clrNamespace, assemblyName);
                if (string.IsNullOrEmpty(prefix))
                {
                    prefix = GetPrefix(manager, type.Assembly, xmlNamespace);
                }
                matchingMapping = new WorkflowMarkupSerializerMapping(prefix, xmlNamespace, clrNamespace, assemblyName, type.Assembly.FullName);
            }
        }
        internal static void GetMappingFromType(WorkflowMarkupSerializationManager manager, Type type, out WorkflowMarkupSerializerMapping matchingMapping, out IList<WorkflowMarkupSerializerMapping> collectedMappings)
        {
            matchingMapping = null;
            collectedMappings = new List<WorkflowMarkupSerializerMapping>();

            string clrNamespace = (type.Namespace != null) ? type.Namespace : String.Empty;
            string xmlNamespace = String.Empty;
            string assemblyName = String.Empty;
            string prefix = String.Empty;

            assemblyName = GetAssemblyName(type, manager);

            if (type.Assembly.FullName.Equals(AssemblyRef.RuntimeAssemblyRef, StringComparison.Ordinal))
            {
                xmlNamespace = StandardXomlKeys.WorkflowXmlNs;
                prefix = StandardXomlKeys.WorkflowPrefix;
            }
            if (type.Assembly.FullName.Equals(AssemblyRef.ActivitiesAssemblyRef, StringComparison.Ordinal))
            {
                xmlNamespace = StandardXomlKeys.WorkflowXmlNs;
                prefix = StandardXomlKeys.WorkflowPrefix;
            }
            else if (type.Assembly == Assembly.GetExecutingAssembly())
            {
                xmlNamespace = StandardXomlKeys.WorkflowXmlNs;
                prefix = StandardXomlKeys.WorkflowPrefix;
            }

            if (xmlNamespace.Length == 0)
            {
                //First lookup the type's assembly for XmlNsDefinitionAttribute
                object[] xmlnsDefinitions = type.Assembly.GetCustomAttributes(typeof(XmlnsDefinitionAttribute), true);
                foreach (XmlnsDefinitionAttribute xmlnsDefinition in xmlnsDefinitions)
                {
                    xmlNamespace = xmlnsDefinition.XmlNamespace;
                    assemblyName = xmlnsDefinition.AssemblyName;

                    if (type.Assembly == manager.LocalAssembly)
                        assemblyName = String.Empty;
                    else if (String.IsNullOrEmpty(assemblyName))
                        assemblyName = GetAssemblyName(type, manager);

                    if (String.IsNullOrEmpty(xmlNamespace))
                        xmlNamespace = GetFormatedXmlNamespace(clrNamespace, assemblyName);
                    prefix = GetPrefix(manager, type.Assembly, xmlNamespace);

                    WorkflowMarkupSerializerMapping mapping = new WorkflowMarkupSerializerMapping(prefix, xmlNamespace, clrNamespace, assemblyName, type.Assembly.FullName);
                    if (xmlnsDefinition.ClrNamespace.Equals(clrNamespace, StringComparison.Ordinal) && matchingMapping == null)
                        matchingMapping = mapping;
                    else
                        collectedMappings.Add(mapping);
                }
            }

            if (matchingMapping == null)
            {
                if (type.Assembly == manager.LocalAssembly)
                    assemblyName = String.Empty;
                else if (String.IsNullOrEmpty(assemblyName))
                    assemblyName = GetAssemblyName(type, manager);

                xmlNamespace = GetFormatedXmlNamespace(clrNamespace, assemblyName);

                if (String.IsNullOrEmpty(prefix))
                    prefix = GetPrefix(manager, type.Assembly, xmlNamespace);

                matchingMapping = new WorkflowMarkupSerializerMapping(prefix, xmlNamespace, clrNamespace, assemblyName, type.Assembly.FullName);
            }
        }
Esempio n. 14
0
        public virtual Type GetType(XmlQualifiedName xmlQualifiedName)
        {
            if (xmlQualifiedName == null)
            {
                throw new ArgumentNullException("xmlQualifiedName");
            }
            string xmlns    = xmlQualifiedName.Namespace;
            string typeName = WorkflowMarkupSerializer.EnsureMarkupExtensionTypeName(xmlQualifiedName);
            Type   type     = null;

            this.cachedXmlQualifiedNameTypes.TryGetValue(xmlQualifiedName, out type);
            if (type == null)
            {
                type = WorkflowMarkupSerializerMapping.ResolveWellKnownTypes(this, xmlns, typeName);
            }
            if (type == null)
            {
                List <WorkflowMarkupSerializerMapping> list = null;
                if (!this.xmlNamespaceBasedMappings.TryGetValue(xmlns, out list))
                {
                    IList <WorkflowMarkupSerializerMapping> matchingMappings  = null;
                    IList <WorkflowMarkupSerializerMapping> collectedMappings = null;
                    WorkflowMarkupSerializerMapping.GetMappingsFromXmlNamespace(this, xmlns, out matchingMappings, out collectedMappings);
                    this.AddMappings(matchingMappings);
                    this.AddMappings(collectedMappings);
                    list = new List <WorkflowMarkupSerializerMapping>(matchingMappings);
                }
                foreach (WorkflowMarkupSerializerMapping mapping in list)
                {
                    string assemblyName = mapping.AssemblyName;
                    string clrNamespace = mapping.ClrNamespace;
                    string name         = xmlQualifiedName.Name;
                    if (clrNamespace.Length > 0)
                    {
                        name = clrNamespace + "." + xmlQualifiedName.Name;
                    }
                    if (assemblyName.Equals(Assembly.GetExecutingAssembly().FullName, StringComparison.Ordinal))
                    {
                        type = Assembly.GetExecutingAssembly().GetType(name);
                    }
                    else if (assemblyName.Length == 0)
                    {
                        if (this.localAssembly != null)
                        {
                            type = this.localAssembly.GetType(name);
                        }
                    }
                    else
                    {
                        string str6 = name;
                        if (assemblyName.Length > 0)
                        {
                            str6 = str6 + ", " + assemblyName;
                        }
                        try
                        {
                            type = this.GetType(str6);
                        }
                        catch
                        {
                        }
                        if (type == null)
                        {
                            type = this.GetType(name);
                            if ((type != null) && !type.AssemblyQualifiedName.Equals(str6, StringComparison.Ordinal))
                            {
                                type = null;
                            }
                        }
                    }
                    if (type != null)
                    {
                        this.cachedXmlQualifiedNameTypes[xmlQualifiedName] = type;
                        return(type);
                    }
                }
            }
            return(type);
        }
 internal static void GetMappingFromType(WorkflowMarkupSerializationManager manager, Type type, out WorkflowMarkupSerializerMapping matchingMapping, out IList<WorkflowMarkupSerializerMapping> collectedMappings)
 {
     matchingMapping = null;
     collectedMappings = new List<WorkflowMarkupSerializerMapping>();
     string clrNamespace = (type.Namespace != null) ? type.Namespace : string.Empty;
     string xmlNamespace = string.Empty;
     string assemblyName = string.Empty;
     string prefix = string.Empty;
     assemblyName = GetAssemblyName(type, manager);
     if (type.Assembly.FullName.Equals("System.Workflow.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL", StringComparison.Ordinal))
     {
         xmlNamespace = "http://schemas.microsoft.com/winfx/2006/xaml/workflow";
         prefix = "wf";
     }
     if (type.Assembly.FullName.Equals("System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", StringComparison.Ordinal))
     {
         xmlNamespace = "http://schemas.microsoft.com/winfx/2006/xaml/workflow";
         prefix = "wf";
     }
     else if (type.Assembly == Assembly.GetExecutingAssembly())
     {
         xmlNamespace = "http://schemas.microsoft.com/winfx/2006/xaml/workflow";
         prefix = "wf";
     }
     if (xmlNamespace.Length == 0)
     {
         foreach (XmlnsDefinitionAttribute attribute in type.Assembly.GetCustomAttributes(typeof(XmlnsDefinitionAttribute), true))
         {
             xmlNamespace = attribute.XmlNamespace;
             assemblyName = attribute.AssemblyName;
             if (type.Assembly == manager.LocalAssembly)
             {
                 assemblyName = string.Empty;
             }
             else if (string.IsNullOrEmpty(assemblyName))
             {
                 assemblyName = GetAssemblyName(type, manager);
             }
             if (string.IsNullOrEmpty(xmlNamespace))
             {
                 xmlNamespace = GetFormatedXmlNamespace(clrNamespace, assemblyName);
             }
             prefix = GetPrefix(manager, type.Assembly, xmlNamespace);
             WorkflowMarkupSerializerMapping item = new WorkflowMarkupSerializerMapping(prefix, xmlNamespace, clrNamespace, assemblyName, type.Assembly.FullName);
             if (attribute.ClrNamespace.Equals(clrNamespace, StringComparison.Ordinal) && (matchingMapping == null))
             {
                 matchingMapping = item;
             }
             else
             {
                 collectedMappings.Add(item);
             }
         }
     }
     if (matchingMapping == null)
     {
         if (type.Assembly == manager.LocalAssembly)
         {
             assemblyName = string.Empty;
         }
         else if (string.IsNullOrEmpty(assemblyName))
         {
             assemblyName = GetAssemblyName(type, manager);
         }
         xmlNamespace = GetFormatedXmlNamespace(clrNamespace, assemblyName);
         if (string.IsNullOrEmpty(prefix))
         {
             prefix = GetPrefix(manager, type.Assembly, xmlNamespace);
         }
         matchingMapping = new WorkflowMarkupSerializerMapping(prefix, xmlNamespace, clrNamespace, assemblyName, type.Assembly.FullName);
     }
 }