* ParameterCollection.cs: fixed IndexOfString, this indexer should be case insensitive
[mono.git] / mcs / class / System.Web.Services / System.Web.Services.Description / ServiceDescriptionImporter.cs
index f4e9c56810be80954229337b585c22975f2a8bf3..5f3e19d53d5d1ee01f3830c73b876511c45896f1 100644 (file)
@@ -41,6 +41,7 @@ using System.Xml.Schema;
 using System.Collections;
 using System.Collections.Specialized;
 using System.Configuration;
+using Microsoft.CSharp;
 
 namespace System.Web.Services.Description {
        public class ServiceDescriptionImporter {
@@ -54,7 +55,7 @@ namespace System.Web.Services.Description {
                
 #if NET_2_0
                CodeGenerationOptions options;
-               CodeDomProvider codeGenerator;
+               CodeDomProvider codeGenerator = new CSharpCodeProvider ();
                ImportContext context;
 #endif
 
@@ -125,11 +126,12 @@ namespace System.Web.Services.Description {
                        if (appSettingUrlKey != null && appSettingUrlKey == string.Empty && style == ServiceDescriptionImportStyle.Server)
                                throw new InvalidOperationException ("Cannot set appSettingUrlKey if Style is Server");
 
-                       serviceDescriptions.Add (serviceDescription, appSettingUrlKey, appSettingBaseUrl);
+                       OnServiceDescriptionAdded (serviceDescription, appSettingUrlKey, appSettingBaseUrl);
                }
 
                internal void OnServiceDescriptionAdded (ServiceDescription serviceDescription, string appSettingUrlKey, string appSettingBaseUrl)
                {
+                       serviceDescriptions.Add (serviceDescription);
                        ImportInfo info = new ImportInfo (serviceDescription, appSettingUrlKey, appSettingBaseUrl);
                        importInfo.Add (info);
                        
@@ -141,7 +143,7 @@ namespace System.Web.Services.Description {
                {
                        ProtocolImporter importer = GetImporter ();
                        
-                       if (!importer.Import (this, codeNamespace, codeCompileUnit, importInfo))
+                       if (!importer.Import (this, codeNamespace, importInfo))
                                throw new Exception ("None of the supported bindings was found");
                                
                        return importer.Warnings;
@@ -186,7 +188,8 @@ namespace System.Web.Services.Description {
                        foreach (WebReference reference in webReferences) 
                        {
                                ServiceDescriptionImporter importer = new ServiceDescriptionImporter ();
-                               importer.CodeGenerator = codeGenerator;
+                               if (codeGenerator != null)
+                                       importer.CodeGenerator = codeGenerator;
                                importer.CodeGenerationOptions = options.CodeGenerationOptions;
                                importer.Context = context;
                                importer.Style = options.Style;