// empty #region GeneratorDataCollectionCreate #if !NCORE // FIXME: THIS DOES NOTHING?! /// <summary> /// this is a template method—as in that it is generally an empty method. /// </summary> static public void GeneratorDataCollectionCreate() { sfd.Filter = "xconfig|*.xconfig|xml|*.xml|all files|*"; #if WPF4 if (!sfd.ShowDialog().Value) { return; } #elif !NCORE if (sfd.ShowDialog() != DialogResult.OK) { return; } #endif List <string> list = new List <string>(); string fname = sfd.FileName; DatabaseCollection c = DatabaseCollection.Load(fname); int dbid = 1, tid = 1; foreach (DatabaseElement elmDb in c.Databases) { using (var ct = new System.Cor3.Data.Context.SQLiteContext()) { foreach (TableElement elmT in elmDb.Items) { foreach (FieldElement elmF in elmT.Fields) { } tid++; } } dbid++; } // string output = string.Empty; // using (SQLiteContext c0 = new SQLiteContext()) // { // c.Select("select * from sqlite_master"); // using (DataView v = c.Data.GetDataView(0)) // { // foreach (DataRowView row in v) // { // list.Add(string.Format("# {0}",row["name"])); // list.Add(""); // list.Add(row["sql"].ToString()); // list.Add(""); // } // } // } }
/// <summary> /// This method moved along with the others. /// I believe that it generally clones the table structures from one table to sql table definitions. /// /// /// it probably would be better to use SQLite3.exe to do this kind of thing. /// </summary> /// <remarks> /// Another reason to ignore this function is it's use of the notably unstable SQLiteContext class—which doesn't seem to bother assigning a file to the loaded and queried database. /// </remarks> static public void ExportSQLiteCreateSnippit(string sqlFile) { List <string> list = new List <string>(); string output = string.Empty; using (var c = new System.Cor3.Data.Context.SQLiteContext()) { c.Select("select * from sqlite_master"); using (DataView v = c.Data.GetDataView(0)) { foreach (DataRowView row in v) { list.Add(string.Format("# {0}", row["name"])); list.Add(""); list.Add(row["sql"].ToString()); list.Add(""); } } } try { File.WriteAllText(sqlFile, string.Join("\r\n", list.ToArray()), System.Text.Encoding.UTF8); } catch (Exception e) { throw new Exception("There was an error writing to the file.", e); } }