Files
mono/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs
T
Gonzalo Paniagua Javier 9848badf22 2002-09-11 Gonzalo Paniagua Javier <[email protected]>
* list: added new files.
	* System.Web.Compilation/AspElements.cs: added WebService directive.
	* System.Web.Compilation/WebServiceCompiler.cs: New file.
	* System.Web.UI/SimpleWebHandlerParser.cs: New file.
	* System.Web.UI/WebServiceParser.cs: New file.

svn path=/trunk/mcs/; revision=7364
2002-09-11 15:53:53 +00:00

46 lines
1.1 KiB
C#

//
// System.Web.Compilation.WebServiceCompiler
//
// Authors:
// Gonzalo Paniagua Javier ([email protected])
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
//
using System;
using System.IO;
using System.Web.UI;
namespace System.Web.Compilation
{
class WebServiceCompiler
{
private WebServiceCompiler ()
{
}
public static Type CompileIntoType (SimpleWebHandlerParser wService)
{
string sourceFile = GenerateSourceFile (wService);
Type type = TemplateFactory.GetTypeFromSource (sourceFile);
if (type.FullName != wService.ClassName)
throw new ApplicationException (String.Format (
"Class={0}, but the class compiled is {1}",
wService.ClassName,
type.FullName));
return type;
}
private static string GenerateSourceFile (SimpleWebHandlerParser wService)
{
//FIXME: should get Tmp dir for this application
string csName = Path.GetTempFileName ();
StreamWriter output = new StreamWriter (File.OpenWrite (csName));
output.Write (wService.Program);
output.Close ();
return csName;
}
}
}