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));
        }
示例#2
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));
        }