Author: mhabersack
Date: 2007-05-15 09:26:56 -0400 (Tue, 15 May 2007)
New Revision: 77400

Added:
   trunk/mcs/class/System.Web/System.Web.Compilation/XsdBuildProvider.cs
Modified:
   trunk/mcs/class/System.Web/ChangeLog
   trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
   trunk/mcs/class/System.Web/System.Web.Compilation/WsdlBuildProvider.cs
   trunk/mcs/class/System.Web/System.Web.dll.sources
Log:
2007-05-15  Marek Habersack  <[EMAIL PROTECTED]>

        * WsdlBuildProvider.cs: make the code actually work - get the
        physical path of VirtualPath instead of converting it to absolute
        URI path.
        Do not generate source, add the code unit to assembly builder
        instead.

        * XsdBuildProvider.cs: added
2007-05-15  Marek Habersack  <[EMAIL PROTECTED]>

        * System.Web.dll.sources: added
        System.Web.Compilation/XsdBuildProvider.cs



Modified: trunk/mcs/class/System.Web/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/ChangeLog        2007-05-15 13:19:44 UTC (rev 
77399)
+++ trunk/mcs/class/System.Web/ChangeLog        2007-05-15 13:26:56 UTC (rev 
77400)
@@ -1,3 +1,8 @@
+2007-05-15  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * System.Web.dll.sources: added
+       System.Web.Compilation/XsdBuildProvider.cs
+
 2007-04-18  Marek Habersack  <[EMAIL PROTECTED]>
 
        * Makefile (System.Web/UplevelHelper.cs): use binary in the

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-05-15 
13:19:44 UTC (rev 77399)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-05-15 
13:26:56 UTC (rev 77400)
@@ -1,3 +1,13 @@
+2007-05-15  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * WsdlBuildProvider.cs: make the code actually work - get the
+       physical path of VirtualPath instead of converting it to absolute
+       URI path.
+       Do not generate source, add the code unit to assembly builder
+       instead.
+
+       * XsdBuildProvider.cs: added
+
 2007-05-08  Marek Habersack  <[EMAIL PROTECTED]>
 
        * TemplateControlCompiler.cs: BuildTemplateMethod is a delegate,

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/WsdlBuildProvider.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/WsdlBuildProvider.cs      
2007-05-15 13:19:44 UTC (rev 77399)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/WsdlBuildProvider.cs      
2007-05-15 13:26:56 UTC (rev 77400)
@@ -50,12 +50,11 @@
 
                public override void GenerateCode (AssemblyBuilder 
assemblyBuilder)
                {
-       
                        CodeCompileUnit unit = new CodeCompileUnit ();
-                       CodeNamespace proxyCode = GetCodeNamespace ();
+                       CodeNamespace proxyCode = new CodeNamespace(null);
                        unit.Namespaces.Add (proxyCode);
                        
-                       string path = VirtualPathUtility.ToAbsolute 
(VirtualPath);
+                       string path = HttpContext.Current.Request.MapPath 
(VirtualPath);
                        ServiceDescription description = 
ServiceDescription.Read (path);
                        ServiceDescriptionImporter importer = new 
ServiceDescriptionImporter ();
                                
@@ -64,24 +63,8 @@
                        importer.CodeGenerator = 
assemblyBuilder.CodeDomProvider;
                        importer.CodeGenerationOptions = 
CodeGenerationOptions.GenerateProperties | 
CodeGenerationOptions.GenerateNewAsync;
                        importer.Import (proxyCode, unit);
-                       
-                       TextWriter writer = assemblyBuilder.CreateCodeFile 
(this);
-                       try {
-                               if (writer != null)
-                                       
assemblyBuilder.CodeDomProvider.GenerateCodeFromCompileUnit (unit, writer, 
null);
-                       } finally {
-                               writer.Close ();
-                       }
+                       assemblyBuilder.AddCodeCompileUnit (unit);
                }
-               
-               CodeNamespace GetCodeNamespace()
-                {
-                        CodeNamespace codeNamespace = new CodeNamespace(null);
-                       codeNamespace.Comments.Add(
-                               new CodeCommentStatement("\n This source code 
was auto-generated by Mono Framework" + Environment.Version + "\n"));
-                        
-                        return codeNamespace;
-                }
        }
 }
 #endif

Added: trunk/mcs/class/System.Web/System.Web.Compilation/XsdBuildProvider.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/XsdBuildProvider.cs       
2007-05-15 13:19:44 UTC (rev 77399)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/XsdBuildProvider.cs       
2007-05-15 13:26:56 UTC (rev 77400)
@@ -0,0 +1,71 @@
+//
+// System.Web.Compilation.WsdlBuildProvider
+//
+// Authors:
+//     Marek Habersack <[EMAIL PROTECTED]>
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System;
+using System.CodeDom;
+using System.CodeDom.Compiler;
+using System.Data;
+using System.IO;
+using System.Reflection;
+using System.Web;
+
+namespace System.Web.Compilation {
+       [BuildProviderAppliesTo 
(BuildProviderAppliesTo.Web|BuildProviderAppliesTo.Code)]
+       sealed class XsdBuildProvider : BuildProvider {
+               public XsdBuildProvider()
+               {
+               }
+
+               public override void GenerateCode (AssemblyBuilder 
assemblyBuilder)
+               {
+                       CodeCompileUnit unit = new CodeCompileUnit ();
+                       CodeNamespace dataSetCode = new CodeNamespace(null);
+                       unit.Namespaces.Add (dataSetCode);
+                       
+                       string path = HttpContext.Current.Request.MapPath 
(VirtualPath);
+                       
+                       DataSet ds = new DataSet ();
+                       ds.ReadXmlSchema (path);
+                       
+                       CodeDomProvider provider = 
assemblyBuilder.CodeDomProvider;
+                       if (provider == null)
+                               throw new HttpException ("Assembly builder has 
no code provider");
+                       
+                       ICodeGenerator generator = provider.CreateGenerator ();
+                       if (generator == null)
+                               throw new HttpException ("Could not create a 
code generator");
+                       TypedDataSetGenerator.Generate (ds, dataSetCode, 
generator);
+                       assemblyBuilder.AddCodeCompileUnit (unit);
+               }
+       }
+}
+#endif
+


Property changes on: 
trunk/mcs/class/System.Web/System.Web.Compilation/XsdBuildProvider.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/mcs/class/System.Web/System.Web.dll.sources
===================================================================
--- trunk/mcs/class/System.Web/System.Web.dll.sources   2007-05-15 13:19:44 UTC 
(rev 77399)
+++ trunk/mcs/class/System.Web/System.Web.dll.sources   2007-05-15 13:26:56 UTC 
(rev 77400)
@@ -78,6 +78,7 @@
 System.Web.Compilation/WebHandlerBuildProvider.cs
 System.Web.Compilation/WebServiceBuildProvider.cs
 System.Web.Compilation/WsdlBuildProvider.cs
+System.Web.Compilation/XsdBuildProvider.cs
 System.Web.Configuration/AuthConfig.cs
 System.Web.Configuration/AuthenticationConfigHandler.cs
 System.Web.Configuration/AuthenticationMode.cs

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to