コード例 #1
0
    public override void Install(System.Collections.IDictionary stateSaver)
    {
      var engine = new SparkViewEngineFactory().CreateViewEngine();
      string assemblyPath = GetType().Assembly.Location;
      string targetPath = Path.ChangeExtension(assemblyPath, ".Templates.dll");

      var descriptors = new List<SparkViewDescriptor>();
      descriptors.Add(new SparkViewDescriptor().AddTemplate("master.spark"));
      engine.BatchCompilation(targetPath, descriptors);
    }
コード例 #2
0
    public void GenerateStrongUrls(UrlStrongModel strongModel, TextWriter writer)
    {
      var engine = new SparkViewEngineFactory().CreateViewEngine();
      engine.LoadBatchCompilation(Assembly.Load("Machine.UrlStrong.Translation.Templates"));

      var descriptor = new SparkViewDescriptor().AddTemplate("master.spark");

      var template = (TemplateBase)engine.CreateInstance(descriptor);

      template.Model = strongModel;
      template.RenderView(writer);
    }