コード例 #1
0
        private void EnqueueType(Type type, XMLNamespace xns)
        {
            Util.Log("WsdlGenerator.EnqueueType "+type+" ns "+xns.Namespace);                      
            if (!type.IsPrimitive || type == s_charType) //char is not a xsd type
            {
                String ns;
                Assembly assem;
                XMLNamespace dependsOnNS = null;

                bool bInteropType = GetNSAndAssembly(type, out ns, out assem);

                // Lookup the namespace
                dependsOnNS = LookupNamespace(ns, assem);
                // Creat a new namespace if neccessary
                if (dependsOnNS == null)
                    dependsOnNS = AddNamespace(ns, assem, bInteropType);

                // The supplied namespace depends directly on the namespace of the type
                String typeString = SudsConverter.MapClrTypeToXsdType(type); //see if this is a xsd type
                if (type.IsInterface || typeString != null || type == s_voidType)
                {
                    // Interfaces aren't in schema section
                    // Any xsd type
                    xns.DependsOnSchemaNS(dependsOnNS, false); 
                }
                else
                    xns.DependsOnSchemaNS(dependsOnNS, true);



                // Enqueue the type if does not belong to system namespace
                if (!type.FullName.StartsWith("System."))
                {
                    Util.Log("WsdlGenerator.EnqueueType place on queue "+type+" ns "+xns.Namespace);                      
                    _queue.Enqueue(type);
                }
            }
        }
コード例 #2
0
 private void EnqueueType(Type type, XMLNamespace xns)
 {
     if (!type.IsPrimitive || (type == s_charType))
     {
         string str;
         Assembly assembly;
         XMLNamespace namespace2 = null;
         bool bInteropType = GetNSAndAssembly(type, out str, out assembly);
         namespace2 = this.LookupNamespace(str, assembly);
         if (namespace2 == null)
         {
             namespace2 = this.AddNamespace(str, assembly, bInteropType);
         }
         string str2 = SudsConverter.MapClrTypeToXsdType(type);
         if ((type.IsInterface || (str2 != null)) || (type == s_voidType))
         {
             xns.DependsOnSchemaNS(namespace2, false);
         }
         else
         {
             xns.DependsOnSchemaNS(namespace2, true);
         }
         if (!type.FullName.StartsWith("System."))
         {
             this._queue.Enqueue(type);
         }
     }
 }
コード例 #3
0
            internal static String TypeName(Type type, bool bEmbedded, XMLNamespace thisxns)
            {
                Util.Log("RealSchemaType.TypeName entry "+type+" bEmbedded "+bEmbedded+" xns "+thisxns.Name);              
                String typeName = null;
                if (type.IsArray)
                    return ProcessArray(type, thisxns);

                String clrTypeName = WsdlGenerator.RefName(type);
                Type clrType = type;

                // If ref type the name ends in &
                if (type.IsByRef)
                {
                    clrType = type.GetElementType(); 
                    clrTypeName = WsdlGenerator.RefName(clrType);
                    if (clrType.IsArray)
                        return ProcessArray(clrType, thisxns);
                }

                typeName = SudsConverter.MapClrTypeToXsdType(clrType);

                if (typeName == null)
                {
                    String ns = type.Namespace;
                    Assembly assem = type.Module.Assembly; 
                    XMLNamespace xns = null;
                    Util.Log("RealSchemaType.TypeName realNS "+ns);
                    xns = (XMLNamespace)thisxns.Generator._typeToInteropNS[type];

                    if (xns == null)
                    {
                        xns = thisxns.LookupSchemaNamespace(ns, assem);
                        if (xns == null)
                        {
                            xns = thisxns.Generator.LookupNamespace(ns,assem);
                            if (xns == null)
                            {
                                xns = thisxns.Generator.AddNamespace(ns, assem);
                            }
                            thisxns.DependsOnSchemaNS(xns, false);
                        }
                        Util.Log("RealSchemaType.TypeName depended NS with assem equals "+xns.Name);
                    }
                    StringBuilder sb = new StringBuilder(256);

                    sb.Append(xns.Prefix);
                    sb.Append(':');
                    sb.Append(clrTypeName);
                    typeName = sb.ToString();
                }

                Util.Log("RealSchemaType.TypeName exit "+typeName);
                return typeName;
            }
コード例 #4
0
ファイル: sdlwriter.cs プロジェクト: ArildF/masters
		// Adds the given type if it has not been encountered before
		private void AddType(Type type, XMLNamespace xns)
		{
			Util.Log("SdlGenerator.AddTypes "+type);                        
			//         System.Array says that it has element type, but returns null
			//         when asked for the element type.                                    
			if (type.HasElementType)
			{
				Type eType = type.GetElementType();
				if (eType != null)
				{
					type = eType;
					while (type.HasElementType)
						type = type.GetElementType();
				}
			}

			if (type.IsPrimitive == false)
			{
				String ns;
				Assembly assem;
				bool bInteropType = GetNSAndAssembly(type, out ns, out assem);

				// Lookup the namespace
				XMLNamespace dependsOnNS = LookupNamespace(ns, assem);
				// Create a new namespace if neccessary
				if (dependsOnNS == null)
					dependsOnNS = AddNamespace(ns, assem, bInteropType);

				// The supplied namespace depends directly on the namespace of the type
				xns.DependsOnSchemaNS(dependsOnNS);

				// Enqueue the type if it does not belong to system namespace
				if ((ns == null) || !ns.StartsWith("System"))
				{
					_queue.Enqueue(type);
				}
			}

			return;
		}