Пример #1
0
        internal void GenerateScaffoldViews(Models.ModelDefinition model)
        {
            ScaffoldViewHost host = new ScaffoldViewHost();
            host.BaseName = className;
            host.ViewName = "Index";
            host.Template = "Index.tt";
            host.Model = model;
            string output = host.ProcessTemplate();
            string filePath = Path.Combine(currentPath, "Views", className, "Index.cshtml");
            File.WriteAllText(filePath, output, Encoding.UTF8);
            parseproj.AddContentFile("Views\\" + className + "\\" + "Index.cshtml", CopyOutPutOptions.PreserveNewest);

            parseproj.Save();
        }
Пример #2
0
 private void CreateScaffoldView(Models.ModelDefinition model,string ViewName,string TemplateName)
 {
     ScaffoldViewHost host = new ScaffoldViewHost();
     host.BaseName = className;
     host.ViewName = ViewName;
     host.Template = TemplateName;
     host.Model = model;
     string output = host.ProcessTemplate();
     string filePath = Path.Combine(currentPath, "Views", className, ViewName+".cshtml");
     File.WriteAllText(filePath, output, Encoding.UTF8);
     parseproj.AddContentFile("Views\\" + className + "\\" + ViewName+".cshtml", CopyOutPutOptions.PreserveNewest);
 }