public static string BuildString(string tableName, string templateName) { TemplateHelper th = new TemplateHelper(CGConfig.Instance.TemplatePath); GCTemplateTools tools = new GCTemplateTools(); CGTable table = GetCGTable(tableName); table.CName = tools.GetTableCName(table.Name); table.PName = tools.GetTablePName(table.Name); th.Put("Table", table); th.Put("Tools", tools); return th.BuildString(templateName); }
public static string BuildFile(string tableName, string templateName, string fileNameFormat, string outputPath) { TemplateHelper th = new TemplateHelper(CGConfig.Instance.TemplatePath); GCTemplateTools tools = new GCTemplateTools(); CGTable table = GetCGTable(tableName); table.CName = tools.GetTableCName(table.Name); table.PName = tools.GetTablePName(table.Name); th.Put("Table", table); th.Put("Tools", tools); string fileName = string.Format(fileNameFormat, table.PName); string fullFileName = Path.Combine(outputPath + fileName); th.Save(templateName, fullFileName); return fullFileName; }