blob: 2cf293c56855dae4a55bc4e9b4618f8f1e636fcf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
//
// System.Web.Compilation.WebServiceCompiler
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (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 (wService.PhysicalPath, 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;
}
}
}
|