
Untitled
By: a guest on
May 12th, 2012 | syntax:
None | size: 1.52 KB | hits: 16 | expires: Never
ITemplate Compile (string path, string id, string input, List<string> usings)
<- assembly.CreateInstance (typeName)
typeName = "Templates_Template_{0}_{1}".FormatWith (id, DateTime.Now.Ticks)
assembly = results.CompiledAssembly
results = provider.CompileAssemblyFromSource (options, code)
provider = new CSharpProvider
<- new Dictionary<string, string>
<- {"CompilerVersion", "v4.0"}
options = new CompilerParameters
.ReferenceAssemblies.Add
"System.dll"
"System.Core.dll"
"Microsoft.CSharp.dll"
path + "Zero.Web.dll"
path + "Zero.Core.dll"
.GenerateInMemory = true
code = inputs.Join("")
inputs = new[]
<- usingsStr
<- "@constant #1...."
<- "@constant #2...."
<- input
usingsStr = builder.ToString()
builder = new StringBuilder()
.AppendFormat ("using {0};", u)
u in usings
.Errors.HasErrors ?
throw new Exception(code + "\n Compiler error: " + b)
b = new StringBuilder()
.Append (e)
e in results.Errors