当前位置: 首页>>代码示例>>C#>>正文


C# DBElement.showEnumerableElement方法代码示例

本文整理汇总了C#中DBElement.showEnumerableElement方法的典型用法代码示例。如果您正苦于以下问题:C# DBElement.showEnumerableElement方法的具体用法?C# DBElement.showEnumerableElement怎么用?C# DBElement.showEnumerableElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBElement的用法示例。


在下文中一共展示了DBElement.showEnumerableElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestR2

        void TestR2()
        {
            "Demonstrating Requirement #2".title();
            //creating new element of type int and string
            DBElement<int, string> element = new DBElement<int, string>();
            element.name = "first element of db";
            element.descr = "int and string type";
            element.timeStamp = DateTime.Now;
            element.children.AddRange(new List<int> { 0, 2, 4, 8 });
            element.payload = "first element's payload";
            element.showElement();
            db.insert(1, element);
            db.showDB();
            WriteLine();
            //creating new element of type string and list of strings
            DBElement<string, List<string>> element2 = new DBElement<string, List<string>>();
            element2.name = "second element of db";
            element2.descr = "strings and strings of string types";
            element2.timeStamp = DateTime.Now;
            element2.children.AddRange(new List<string> { "SMA", "OOD", "Project2" });
            element2.payload = new List<string> { "second", "SMA", "project" };
            element2.showEnumerableElement();
            db2.insert("2", element2);
            db2.showEnumerableDB();
            WriteLine();

        }
开发者ID:abhilash215,项目名称:Remote-Key-Value-Database,代码行数:27,代码来源:TestExec.cs

示例2: TestR2

    public void TestR2()
    {
      "Demonstrating Requirement #2".title('=');
      "Database with string as payload".title();
      DBElement<int, string> elem = new DBElement<int, string>();
      elem.name = "element";
      elem.descr = "test element";
      elem.timeStamp = DateTime.Now;
      elem.children.AddRange(new List<int>{ 1, 2, 3 });
      elem.payload = "elem's payload";
      elem.showElement();
      db.insert(1, elem);
      db.showDB();
      WriteLine();
      "database with list of strings as payload".title();
      DBElement<string, List<string>> element = new DBElement<string, List<string>>();
      element.name = "element2";
      element.descr = "test element for list of strings as value";
      element.timeStamp = DateTime.Now;
      element.children.AddRange(new List<string> { "one","two"});
      element.payload = new List<string> { "element's payload", "2nd payload" };
      element.showEnumerableElement();
      enum_db.insert("enum_one", element);
      enum_db.showEnumerableDB();
      WriteLine();

    }
开发者ID:yogeshchaudhari16991,项目名称:RemoteNoSQLDB,代码行数:27,代码来源:TestExec.cs

示例3: key_value_search

    /* Defining a query using lambda function to search specific key 
    */
    public bool key_value_search(DBEngine<string, DBElement<string, List<string>>> db, out IQuery<string, DBElement<string, List<string>>> i_query, QueryEngine<string, DBElement<string, List<string>>> qe, string key_to_search = "12345")
    {
      "Query for value with specified key (key = element2):".title();
      WriteLine();

      Func<string, string, bool> keyValueSearch = (string key, string search) => //lambda function
      {
        if (!db.Keys().Contains(key))
          return false;
        else
        {
          if (key == (search))
          {
            DBElement<string, List<string>> ele = new DBElement<string, List<string>>();
            db.getValue(key, out ele);
            return true;
          }
          else { return false; }
        }
      };
      // pass query to query engine and call simpleQuery to make query on DBEngine

      if (qe.simpleQuery(keyValueSearch, key_to_search.ToString(), out i_query))
      {
        WriteLine();
        foreach (var key in i_query.Keys())
        {
          DBElement<string, List<string>> temp = new DBElement<string, List<string>>();
          i_query.getValue(key, out temp);
          WriteLine("key : {0}", key);
          temp.showEnumerableElement();
          WriteLine();
        }
        return true;
      }
      else
      {
        return false;
      }
    }
开发者ID:yogeshchaudhari16991,项目名称:RemoteNoSQLDB,代码行数:42,代码来源:QueryPredicate.cs

示例4: Main

        static void Main(string[] args)
        {
            "Testing DBEngine Package".title('='); ;
            WriteLine();

            "Test db of scalar elements".title();
            WriteLine();
             //creation of new elements
            DBElement<int, string> elem1 = new DBElement<int, string>();
            elem1.payload = "a payload";

            DBElement<int, string> elem2 = new DBElement<int, string>("Darth Vader", "Evil Overlord");
            elem2.payload = "The Empire strikes back!";

            var elem3 = new DBElement<int, string>("Luke Skywalker", "Young HotShot");
            elem3.payload = "X-Wing fighter in swamp - Oh oh!";

            if (verbose)
            {
                Write("\n --- Test DBElement<int,string> ---");
                WriteLine();
                elem1.showElement();
                WriteLine();
                elem2.showElement();
                WriteLine();
                elem3.showElement();
                WriteLine();
            }

            Write("\n --- Test DBEngine<int,DBElement<int,string>> ---");
            WriteLine();

            int key = 0;
            Func<int> keyGen = () => { ++key; return key; };  // function to generate keys

                              // new database created
            DBEngine<int, DBElement<int, string>> db = new DBEngine<int, DBElement<int, string>>();
            bool p1 = db.insert(keyGen(), elem1);
            bool p2 = db.insert(keyGen(), elem2);
            bool p3 = db.insert(keyGen(), elem3);
            if (p1 && p2 && p3)
                Write("\n  all inserts succeeded");
            else
                Write("\n  at least one insert failed");
            db.showDB();
            WriteLine();

            "Test db of enumerable elements".title();
            WriteLine();
                       //new element created
            DBElement<string, List<string>> newelem1 = new DBElement<string, List<string>>();
            newelem1.name = "newelem1";
            newelem1.descr = "test new type";
            newelem1.payload = new List<string> { "one", "two", "three" };
                       //new element created
            DBElement<string, List<string>> newerelem1 = new DBElement<string, List<string>>();
            newerelem1.name = "newerelem1";
            newerelem1.descr = "better formatting";
            newerelem1.payload = new List<string> { "alpha", "beta", "gamma" };
            newerelem1.payload.Add("delta");
            newerelem1.payload.Add("epsilon");
                          //new element created
            DBElement<string, List<string>> newerelem2 = new DBElement<string, List<string>>();
            newerelem2.name = "newerelem2";
            newerelem2.descr = "better formatting";
            newerelem2.children.AddRange(new List<string> { "first", "second" });
            newerelem2.payload = new List<string> { "a", "b", "c" };
            newerelem2.payload.Add("d");
            newerelem2.payload.Add("e");

            if (verbose)
            {
                Write("\n --- Test DBElement<string,List<string>> ---");
                WriteLine();
                newelem1.showEnumerableElement();
                WriteLine();
                newerelem1.showEnumerableElement();
                WriteLine();
                newerelem2.showEnumerableElement();
                WriteLine();
            }

            Write("\n --- Test DBEngine<string,DBElement<string,List<string>>> ---");

            int seed = 0;
            string skey = seed.ToString();
            Func<string> skeyGen = () =>
            {
                ++seed;
                skey = "string" + seed.ToString();
                skey = skey.GetHashCode().ToString();
                return skey;
            };

            DBEngine<string, DBElement<string, List<string>>> newdb =
              new DBEngine<string, DBElement<string, List<string>>>();
            newdb.insert(skeyGen(), newelem1);
            newdb.insert(skeyGen(), newerelem1);
            newdb.insert(skeyGen(), newerelem2);
            newdb.showEnumerableDB();
//.........这里部分代码省略.........
开发者ID:abhilash215,项目名称:Remote-Key-Value-Database,代码行数:101,代码来源:Display.cs

示例5: Main

 static void Main(string[] args)
 {
     
     //<------Create test DB----->
     "Testing for PersistEngine package".title();
     DBEngine<int, DBElement<int, string>> db = new DBEngine<int, DBElement<int, string>>();
     DBEngine<string, DBElement<string, List<string>>> enum_db = new DBEngine<string, DBElement<string, List<string>>>();
     
     for (int i = 0; i < 3; i++)
     {
         DBElement<int, string> elem = new DBElement<int, string>();
         elem.name = "element";
         elem.descr = "test element";
         elem.timeStamp = DateTime.Now;
         elem.children.AddRange(new List<int> { 1, 2, 3 });
         elem.payload = "elem's payload";
         elem.showElement();
         db.insert(i, elem);
     }
     db.showDB();
     WriteLine();
     //<-------Save DB data to XML file--------->
     "Demonstrating XDocument class".title('=');
     WriteLine();
     "Creating XML string using XDocument".title();
     WriteLine();
     db.create_xml_from_db(false);
     //<---Empty DBEngine<int, DBElement<int, string>>--->
     "Removing entries from Db if any".title();
     if (db != null)
     {
         db.removeAll();
     }
     "Current DB state".title();
     db.showDB();
     WriteLine();
     db.create_db_from_xml();
     WriteLine();
     //<---------Create test enum DB-------->
     for (int i = 0; i < 3; i++)
     {
         DBElement<string, List<string>> elem = new DBElement<string, List<string>>();
         elem.name = "element";
         elem.descr = "test element";
         elem.timeStamp = DateTime.Now;
         elem.children.AddRange(new List<string> { "child1", "child2" });
         elem.payload = new List<string> { "payload 1", "payload 2" };
         elem.showEnumerableElement();
         enum_db.insert(i.ToString(), elem);
     }
     enum_db.showEnumerableDB();
     WriteLine();
     //<-------Save enum_DB data to XML file--------->
     "Creating XML string using XDocument".title();
     enum_db.create_xml_from_enum_db(false);
     WriteLine();
     
     if (enum_db != null)
     {
         enum_db.removeAll();
     }
     //<----Empty DBEngine<string, DBElement<string, List<string>>----->
     "Removing entries from enum Db if any".title();
     if (enum_db != null)
     {
         string[] key_array = enum_db.Keys().ToArray();
         foreach (string key in key_array)
         {
             enum_db.remove(key);
         }
     }            
     "Cureent enum DB state".title();
     enum_db.showEnumerableDB();
     WriteLine();
     enum_db.create_enum_db_from_xml();
     WriteLine();
     WriteLine();
     
 }
开发者ID:yogeshchaudhari16991,项目名称:NoSQLDatabase,代码行数:79,代码来源:PersistEngine.cs

示例6: TestR3

    void TestR3()
    {
      WriteLine();
      "Demonstrating Requirement #3".title('=');
      WriteLine();
      "Adding Key-Value pair to database".title();
      DBElement<int, string> element = new DBElement<int, string>();
      element.addElementData("element3", "test element for adding key-value pair to databse with value as string", DateTime.Now, new List<int> { 1, 2 }, "test elemet3's payload");
      "element to be added to database".title();
      element.showElement();
      db.insert(2, element);
      db.showDB();                        
      WriteLine();

      "Adding Key-Value pair to enumerable database".title();
      DBElement<string, List<string>> listelement = new DBElement<string, List<string>>();
      listelement.addElementData("element4", "test element for adding key-value pair to databse with value as list of string", DateTime.Now, new List<string> { "1", "two" }, new List<string> { "test elemet4's payload" });
      "element to be added to database".title();
      listelement.showEnumerableElement();
      enum_db.insert("enum_two", listelement);
      enum_db.showEnumerableDB();  
      WriteLine();
       
      "Deleting Key-Value pair from database".title();
      "Element with key=1 will be deleted from database".title();
      "Element with key=1:".title();
      DBElement<int, string> remove_element = new DBElement<int, string>();
      db.getValue(1, out remove_element);
      remove_element.showElement();
      db.remove(1);
      WriteLine();
      "Modified Database: ".title();
      db.showDB();
      WriteLine();

      "Deleting Key-Value pair from enumerable database".title();
      "Element with key=enum_one will be deleted from database".title();
      "Element with key=enum_one:".title();
      DBElement<string, List<string>> remove_enum_element = new DBElement<string, List<string>>();
      enum_db.getValue("enum_one", out remove_enum_element);
      remove_enum_element.showEnumerableElement();
      enum_db.remove("enum_one");
      WriteLine();
      "Modified enumerable Database: ".title();
      enum_db.showEnumerableDB();
      WriteLine();
      
    }
开发者ID:yogeshchaudhari16991,项目名称:RemoteNoSQLDB,代码行数:48,代码来源:TestExec.cs

示例7: TestR7

 public void TestR7()
 {
   "Demonstrating Requirement #7".title('=');
   WriteLine();
   "Adding elements to db".title();
   WriteLine();
   for (int i = 0; i < 3; i++)
   {
       DBElement<string, List<string>> elem = new DBElement<string, List<string>>();
       elem.name = "element";
       elem.descr = "test element";
       elem.timeStamp = new DateTime(2015,10,(2+i));
       elem.children.AddRange(new List<string> { "one", "two", "three" });
       elem.payload = new List<string>{ "elem's payload1","payload2","payload 3"};
       elem.showEnumerableElement();
       WriteLine();
       enum_db.insert((12345+i).ToString(), elem);
   }     
   "current DB status:".title();
   enum_db.showEnumerableDB();
   IQuery<string, DBElement<string, List<string>>> i_query = new DBEngine<string, DBElement<string, List<string>>>();
   QueryEngine<string, DBElement<string, List<string>>> qe = new QueryEngine<string, DBElement<string, List<string>>>(enum_db);
   QueryPredicate qp = new QueryPredicate();
   qp.key_value_search(enum_db, out i_query, qe);
   WriteLine();
   qp.key_children_search(enum_db, out i_query, qe);
   WriteLine();
   qp.pattern_matching(enum_db, out i_query, qe, "12345");
   WriteLine();
   qp.pattern_matching(enum_db, out i_query, qe);
   WriteLine();
   qp.metadata_string(enum_db, out i_query, qe);
   WriteLine();
   DateTime start = new DateTime(2015, 10, 4);
   DateTime end = new DateTime(2015, 10, 5);
   qp.date_time_specific(enum_db, out i_query, qe, start, end);
   WriteLine();
   qp.default_date_time_specific(enum_db, out i_query, qe, start);
   WriteLine();
 }
开发者ID:yogeshchaudhari16991,项目名称:RemoteNoSQLDB,代码行数:40,代码来源:TestExec.cs

示例8: TestR4

 void TestR4(string edit_action)
 {
   DBElement<string, List<string>> element = new DBElement<string, List<string>>();
   element.addElementData("element1", "test element for editing key-value pair to databse with value as string", DateTime.Now, new List<string> { "enum_one", "enum_two" }, new List<string> { "test element1's payload" });
   enum_db.insert("enum_one", element);
   "Demonstrating Requirement #4".title();
   DBElement<string, List<string>> edit_element = new DBElement<string, List<string>>();
   enum_db.getValue("enum_one", out edit_element);
   "Element to be edited".title();
   edit_element.showEnumerableElement();
   WriteLine();
   "Database before editing".title();
   enum_db.showEnumerableDB();
   WriteLine();
   switch (edit_action)
   {
     case "edit metadata":
       edit_element.edit_metadata(edit_action);
       goto default;
     case "add children":
       edit_element.add_children(edit_action);
       goto default;
     case "remove children":
       edit_element.remove_children(edit_action);
       goto default;
     case "edit payload":
       edit_element.edit_payload();
       goto default;
     default:
       "element after editing".title();
       edit_element.showEnumerableElement();
       "Databaser after editing".title();
       enum_db.showEnumerableDB();
       WriteLine();
       break;
   }  
 }
开发者ID:yogeshchaudhari16991,项目名称:RemoteNoSQLDB,代码行数:37,代码来源:TestExec.cs

示例9: Main

        static void Main(string[] args)
        {
            DBEngine<string, DBElement<string, List<string>>> db = new DBEngine<string, DBElement<string, List<string>>>();
            for (int i = 0; i < 3; i++)
            {
                DBElement<string, List<string>> elem = new DBElement<string, List<string>>();
                elem.name = "element";
                elem.descr = "test element";
                elem.timeStamp = new DateTime(2015, 10, (2 + i));
                elem.children.AddRange(new List<string> { "element1", "element2", "element3" });
                elem.payload = new List<string> { "elem's payload1", "elem's payload2" };
                elem.showEnumerableElement();
                WriteLine();
                db.insert("element"+(12345 + i).ToString(), elem);
            }
            for (int i = 0; i < 3; i++)
            {
                DBElement <string, List<string>> elem = new DBElement<string, List<string>>();
                elem.name = "db data";
                elem.descr = "db data description";
                elem.timeStamp = DateTime.Now;
                elem.children.AddRange(new List<string> { "element12345", "element12346", "element12347" });
                elem.payload = new List<string> { "elem's payload1", "elem's payload2" };
                elem.showEnumerableElement();
                WriteLine();
                db.insert("element"+(i+1).ToString(), elem);
            }

            IQuery<string, DBElement<string, List<string>>> i_query = new DBEngine<string, DBElement<string, List<string>>>();
            QueryEngine<string, DBElement<string, List<string>>> qe = new QueryEngine<string, DBElement<string, List<string>>>(db);
            //<---- creating a query predicate object and calling each query on given test database --->
            QueryPredicate qp = new QueryPredicate();
            qp.key_value_search(db, i_query, qe);
            WriteLine();
            qp.key_children_search(db, i_query, qe);
            WriteLine();
            qp.pattern_matching(db, i_query, qe);
            WriteLine();
            qp.default_pattern_matching(db, i_query, qe);
            WriteLine();
            qp.metadata_string(db, i_query, qe);
            WriteLine();
            qp.date_time_specific(db, i_query, qe);
            WriteLine();
            qp.default_date_time_specific(db, i_query, qe);
            WriteLine();
        }
开发者ID:yogeshchaudhari16991,项目名称:RemoteNoSQLDB,代码行数:47,代码来源:QueryPredicate.cs

示例10: date_time_specific

 /* Defining a query using lambda function to search specific elements belonging in specific  
 *  time-interval with end of time interval equal to present
 */
 public void date_time_specific(DBEngine<string, DBElement<string, List<string>>> db, out IQuery<string, DBElement<string, List<string>>> i_query, QueryEngine<string, DBElement<string, List<string>>> qe, DateTime start, DateTime end = new DateTime())
 {
   "Query for keys with specified date time interval: start=10/4/2015 end=10/5/2015".title();
   WriteLine();
   Func<string, DateTime, DateTime, bool> TimeDateQuery = (string key, DateTime query_start, DateTime query_end) => //lambda function
   {
     if (!db.Keys().Contains(key))
       return false;
     else
     {
       DBElement<string, List<string>> ele = new DBElement<string, List<string>>();
       db.getValue(key, out ele);
       int start_result = DateTime.Compare(query_start, ele.timeStamp);
       int end_result = DateTime.Compare(query_end, ele.timeStamp);
       if ((start_result <= 0) && (end_result >= 0))
       {
         return true;
       }
       else return false;
     }
   };
   // pass query to query engine and call simpleQuery to make query on DBEngine
   qe.simpleQueryDate(TimeDateQuery, out i_query, start, end);
   WriteLine();
   foreach (var key in i_query.Keys())
   {
     DBElement<string, List<string>> temp = new DBElement<string, List<string>>();
     i_query.getValue(key, out temp);
     WriteLine("key : {0}", key);
     temp.showEnumerableElement();
     WriteLine();
   }
 }
开发者ID:yogeshchaudhari16991,项目名称:RemoteNoSQLDB,代码行数:36,代码来源:QueryPredicate.cs

示例11: metadata_string

 /* Defining a query using lambda function to search specific string in metadata 
 */
 public bool metadata_string(DBEngine<string, DBElement<string, List<string>>> db, out IQuery<string, DBElement<string, List<string>>> i_query, QueryEngine<string, DBElement<string, List<string>>> qe, string metadata_str = "ele")
 {
   "Query for specified string in metadata: String = 'ele' ".title();
   WriteLine();
   Func<string, string, bool> stringMetadata = (string key, string search) => //lambda function
   {
     if (!db.Keys().Contains(key))
       return false;
     else
     {
       DBElement<string, List<string>> ele = new DBElement<string, List<string>>();
       db.getValue(key, out ele);
       if (ele.name.Contains(search) || ele.descr.Contains(search))
         return true;
       else return false;
     }
   };
   // pass query to query engine and call simpleQuery to make query on DBEngine
   if (qe.simpleQuery(stringMetadata, metadata_str, out i_query))
   {
     WriteLine();
     foreach (var key in i_query.Keys())
     {
       DBElement<string, List<string>> temp = new DBElement<string, List<string>>();
       i_query.getValue(key, out temp);
       WriteLine("key : {0}", key);
       temp.showEnumerableElement();
       WriteLine();
     }
     return true;
   } else
   {
     return false;
   }
 }
开发者ID:yogeshchaudhari16991,项目名称:RemoteNoSQLDB,代码行数:37,代码来源:QueryPredicate.cs

示例12: default_pattern_matching

    /* Defining a query using lambda function to search specific key matching default pattern
    */
    public void default_pattern_matching(DBEngine<string, DBElement<string, List<string>>> db, out IQuery<string, DBElement<string, List<string>>> i_query, QueryEngine<string, DBElement<string, List<string>>> qe)
    {
      string pattern = "";
      "Query for keys matching with specified pattern (pattern = none  -> default case):".title();
      WriteLine();
      Func<string, string, bool> keysMatchingPattern = (string key, string search) => //lambda function
      {
        if (!db.Keys().Contains(key))
          return false;
        else
        {
          if (key.ToString().Contains(search))
          {
            DBElement<string, List<string>> ele = new DBElement<string, List<string>>();
            db.getValue(key, out ele);
            return true;
          }
          else return false;
        }
      };
      // pass query to query engine and call simpleQuery to make query on DBEngine
      qe.simpleQuery(keysMatchingPattern, pattern, out i_query);
      WriteLine();
      foreach (var key in i_query.Keys())
      {
        DBElement<string, List<string>> temp = new DBElement<string, List<string>>();
        i_query.getValue(key, out temp);
        WriteLine("key : {0}", key);
        temp.showEnumerableElement();
        WriteLine();
      }

    }
开发者ID:yogeshchaudhari16991,项目名称:RemoteNoSQLDB,代码行数:35,代码来源:QueryPredicate.cs

示例13: display_children

 private void display_children(IQuery<string, DBElement<string, List<string>>> i_query, DBEngine<string, DBElement<string, List<string>>> db)
 {
   foreach (var key in i_query.Keys())
   {
     DBElement<string, List<string>> temp = new DBElement<string, List<string>>();
     i_query.getValue(key, out temp);
     WriteLine("children of element with key {0} :", key);
     WriteLine();
     if (temp.children != null)
     {
       int i = 0;
       foreach (string child in temp.children)
       {
         WriteLine("Children {0}", ++i);
         DBElement<string, List<string>> temp_child = new DBElement<string, List<string>>();
         if (db.Keys().Contains(child))
         {
           db.getValue(child, out temp_child);
           WriteLine("key : {0}", child);
           temp_child.showEnumerableElement();
           WriteLine();
         }
         else
         {
           WriteLine("no value with key {0} is present in database", child);
           WriteLine();
         }
       }
     }
   }
 }
开发者ID:yogeshchaudhari16991,项目名称:RemoteNoSQLDB,代码行数:31,代码来源:QueryPredicate.cs

示例14: TestR12

 void TestR12()
 {
     try
     {
         "\nThe database is shown below:".title();
         WriteLine("\n Key: Apple");
         DBElement<string, List<string>> elem1 = new DBElement<string, List<string>>();
         elem1.name = "Apple";
         elem1.descr = "Type of fruit";
         elem1.timeStamp = DateTime.Now;
         elem1.children.AddRange(new List<string> { "three" });
         elem1.payload = new List<string> { "Seven" };
         elem1.category = new List<string> { "fruit", "drink" };
         dbCategory.insert("Apple", elem1);
         elem1.showEnumerableElement();
         displayCategory(elem1.category);
         WriteLine("\n Key: Banana");
         DBElement<string, List<string>> elem2 = new DBElement<string, List<string>>();
         elem2.name = "Banana";
         elem2.descr = "Type of fruit";
         elem2.timeStamp = DateTime.Now;
         elem2.children.AddRange(new List<string> { "two" });
         elem2.payload = new List<string> { "Five", "Six" };
         elem2.category = new List<string> { "fruit" };
         dbCategory.insert("Banana", elem2);
         elem2.showEnumerableElement();
         displayCategory(elem2.category);
         WriteLine("\n Key: Blackberry");
         DBElement<string, List<string>> elem3 = new DBElement<string, List<string>>();
         elem3.name = "Blackberry";
         elem3.descr = "Type of fruit or phone";
         elem3.timeStamp = DateTime.Now;
         elem3.children.AddRange(new List<string> { "one" });
         elem3.payload = new List<string> { "Eight" };
         elem3.category = new List<string> { "fruit", "phone" };
         dbCategory.insert("Blackberry", elem3);
         elem3.showEnumerableElement();
         displayCategory(elem3.category);
         dictCategory = new Dictionary<string, List<string>>();
         dictCategory.Add("fruit", new List<string> { "Apple", "Banana" });
         List<string> values = new List<string>();
         dictCategory.TryGetValue("fruit", out values);
         dynamic result = qEngine.getKeyForCategory(dbCategory, values);
         "\nMatched keys for category 'fruit'".title();
         displayStringKeys(result);
     }
     catch (Exception e) { WriteLine("\n" + e.Message + "\n"); }
 }
开发者ID:rakeshh91,项目名称:Android-Projects,代码行数:48,代码来源:TestExec.cs

示例15: TestR7

        void TestR7()
        {
            //Demonstrating queries
            "Demonstrating Requirement #7".title();
            WriteLine();
            QueryEngine queryv = new QueryEngine();
            DBElement<int, string> displayresc = new DBElement<int, string>();
            DBElement<int, string> displayres = new DBElement<int, string>();

            //demonstrating query 1
            Console.WriteLine("\n \n getting value for key 1");
            displayres = queryv.queryvalue<int, DBElement<int, string>, string>(db, 1);
            if (displayres != null)
                displayres.showElement();

            DBElement<string, List<string>> valuestring = new DBElement<string, List<string>>();
            Console.WriteLine("\n \n getting value for key 2");
            valuestring = queryv.queryvalue<string, DBElement<string, List<string>>, string>(db2, "2");
            if (valuestring != null)
                valuestring.showEnumerableElement();

            // demonstrating query 2
            Console.WriteLine("\n \n getting children for key 1");
            List<int> tchildlist = new List<int>();
            tchildlist = queryv.querychildren<int, DBElement<int, string>, string>(db, 1);
            if (tchildlist != null)
            {
                foreach (int i in tchildlist)
                    Console.WriteLine(i);
            }


        }
开发者ID:abhilash215,项目名称:Remote-Key-Value-Database,代码行数:33,代码来源:TestExec.cs


注:本文中的DBElement.showEnumerableElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。