예제 #1
0
 public Table(Type type, StaticDBCreater outer)
 {
     this.outer = outer;
     this.Type  = type;
     //Sorted = true;
     //foreach (var property in type.GetProperties())
     //    foreach (var key in property.GetCustomAttributes(typeof(ForeignKey), true).Cast<ForeignKey>())
     //        if (key.Category)
     //            Sorted = false;
 }
예제 #2
0
        public static void SerializeDatabase(StaticDBCreater db, Stream outStream)
        {
            int i         = 0;
            var typeIndex = db.Tables.ToDictionary(x1 => x1, x2 => i++);

            using (StreamWriter writer = new StreamWriter(outStream))
            {
                foreach (Type table in db.Tables)
                {
                    writer.Write(typeIndex[table] + ";" + table.AssemblyQualifiedName + ";");
                    var members = createMembers(table, typeIndex);
                    writer.Write(String.Join(",", members));
                    writer.WriteLine();
                }
            }
        }