예제 #1
0
 public string GenerateTableDataScript(string tableName)
 {
     TableScriptBuilder builder = new TableScriptBuilder();
       var table = new TableDataDesc(Db.Value.Tables[tableName]);
       builder.Append(table);
       return builder.GetScript();
 }
예제 #2
0
 public void Append(TableDataDesc table)
 {
     var rows = new List<RowDesc>();
       foreach(var scriptedRow in table.ScriptedData)
       {
     var row = DataDescFactory.CreateRowDescriptor(scriptedRow, table.PrimaryColumns);
     rows.Add(row);
       }
       var gen = new RowScriptGen();
       //Header
       var header = rows.TakeWhile(r => false == r is InsertRowDesc);
       //_sb.Append(gen.GenerateScript(header));
       _sb.AppendFormat("{0}{1}", gen.GenerateScript(header), Environment.NewLine);
       //Data
       var data = rows.Where(r => r is InsertRowDesc).Select(r => r as InsertRowDesc);
       _sb.AppendFormat("{0}{1}", gen.GenerateMergeScript(data, true), Environment.NewLine);
       //Footer
       var footer = rows.Skip(header.Count() + data.Count());
       _sb.AppendFormat("{0}{1}", gen.GenerateScript(footer), Environment.NewLine);
 }