{         // Main method
        static void Main(string[] args)
        {
            "Testing persistence Package".title('=');
            WriteLine();
            PersistenceEngine persiseng = new PersistenceEngine();
            // creating new databse and new database elements
            DBEngine <int, DBElement <int, string> > pdb = new DBEngine <int, DBElement <int, string> >();

            DBElement <int, string> pel1 = new DBElement <int, string>("first element", "SMA");
            DBElement <int, string> pel2 = new DBElement <int, string>("second element ", "OOD");
            DBElement <int, string> pel3 = new DBElement <int, string>("third element", "DP");

            pel1.payload = "first payload";
            pel1.children.AddRange(new List <int> {
                111, 112, 113
            });

            pel2.payload = "second payload";
            pel2.children.AddRange(new List <int> {
                221, 222, 223
            });

            pel3.payload = "third payload";
            pel3.children.AddRange(new List <int> {
                331, 332, 333
            });

            // inserting elements to database
            pdb.insert(1, pel1);
            pdb.insert(2, pel2);
            pdb.insert(3, pel3);
            pdb.showDB();
            WriteLine();
            persiseng.persistdb <int, DBElement <int, string>, string>(pdb);
        }
示例#2
0
        void TestR5()
        {
            // persisting database contents to an XML file
            "\n Demonstrating Requirement #5".title();
            WriteLine();

            PersistenceEngine persisengtest = new PersistenceEngine();

            persisengtest.persistdb <int, DBElement <int, string>, string>(db3);
            WriteLine();
            db.showDB();
            WriteLine("\n \n XML file created"); // XML file created
        }