Exemplo n.º 1
0
        // main method to test DBExtensions package
        static void Main(string[] args)
        {
            "Testing DBExtensions Package".title('=');
            WriteLine();

            // creation of new element
            Write("\n --- Test DBElement<int,string> ---");
            DBElement <int, string> elem1 = new DBElement <int, string>();

            elem1.payload = "a payload";
            Write(elem1.showElement <int, string>());

            // creation of new database
            DBEngine <int, DBElement <int, string> > dbs = new DBEngine <int, DBElement <int, string> >();

            dbs.insert(1, elem1);
            dbs.show <int, DBElement <int, string>, string>();
            WriteLine();

            Write("\n --- Test DBElement<string,List<string>> ---");
            // creation of new element
            DBElement <string, List <string> > newelem1 = new DBElement <string, List <string> >();

            newelem1.name     = "newelem1";
            newelem1.descr    = "test new type";
            newelem1.children = new List <string> {
                "Key1", "Key2"
            };
            newelem1.payload = new List <string> {
                "one", "two", "three"
            };
            Write(newelem1.showElement <string, List <string>, string>());

            DBEngine <string, DBElement <string, List <string> > > dbe = new DBEngine <string, DBElement <string, List <string> > >();

            dbe.insert("key1", newelem1);
            dbe.show <string, DBElement <string, List <string> >, List <string>, string>();

            Write("\n\n");
        }
 public static void showEnumerableDB(this DBEngine <string, DBElement <string, List <string> > > db)
 {
     db.show <string, DBElement <string, List <string> >, List <string>, string>();
 }
 public static void showDB(this DBEngine <int, DBElement <int, string> > db)
 {
     db.show <int, DBElement <int, string>, string>();
 }