public Action<Stream> RenderView(ViewLocation viewLocation, dynamic model) { if (viewLocation == null) { return stream => { }; } return stream => { var writer = new StreamWriter(stream); writer.Write(viewLocation.Contents.ReadToEnd()); writer.Flush(); }; }
/// <summary> /// RenderView method /// </summary> /// <param name="viewLocation">ViewLocation object</param> /// <param name="model">dynamic model object</param> /// <returns>Action object</returns> public Action<Stream> RenderView(ViewLocation viewLocation, dynamic model) { return stream => { this.ViewLocation = viewLocation; if (!this.Cache.ContainsKey(viewLocation.Location)) { string template = File.ReadAllText(viewLocation.Location); Razor.AddResolver(name => GetTemplate(name)); Razor.CompileWithAnonymous(template, viewLocation.Location); this.Cache.Add(viewLocation.Location, DateTime.Now); } string result = Razor.Run(model, viewLocation.Location); var writer = new StreamWriter(stream); writer.Write(result); writer.Flush(); }; }
public Action<Stream> RenderView(ViewLocation viewLocation, dynamic model) { throw new NotImplementedException(); }