public override void OnManagerSave(object model) { CsHtml = CsHtml.Trim(); string[] lines = CsHtml.Split(new[] { '\r', '\n' }); // Create the result string modelType = "Catfish.Models.ViewModels.EntityViewModel"; if (CsHtml.StartsWith("@model")) { modelType = lines.FirstOrDefault().Substring(6).Trim(); } Assembly result; try { result = ViewHelper.CompileView(string.Join("\n", lines, 1, lines.Length - 1), ClassId, "Catfish.Models.Regions.CSEntityPanel", modelType, "Catfish.Helpers.CatfishCompiledView", GetReferencedAssemblies()); }catch (HttpCompileException ex) { throw (ex); } // Convert the code to binary CompiledCode = System.IO.File.ReadAllBytes(result.Location); base.OnManagerSave(model); }