本文整理汇总了C#中DBElement类的典型用法代码示例。如果您正苦于以下问题:C# DBElement类的具体用法?C# DBElement怎么用?C# DBElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DBElement类属于命名空间,在下文中一共展示了DBElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: insert
// function to insert into database
public XElement insert(XElement dbe, DBEngine<int, DBElement<int, string>> db)
{
DBElement<int, string> elem = new DBElement<int, string>();
Console.WriteLine("\n");
Console.WriteLine("\n----------Insert operation----------");
elem.name = dbe.Element("name").Value;
elem.descr = dbe.Element("descr").Value;
elem.payload = dbe.Element("payload").Value;
List<int> childrenlist = new List<int>();
XElement db1 = dbe.Element("children");
foreach (var v in db1.Elements("dbkey")) childrenlist.Add(Int32.Parse(v.Value));
elem.children = childrenlist;
bool result = db.insert(Int32.Parse((dbe.Element("key").Value)), elem);
db.showDB();
if (result == true)
{
XElement s = new XElement("result", "\n element inserted successfully ");
return s;
}
else
{
XElement f = new XElement("result", "Failure");
return f;
}
}
开发者ID:abhilash215,项目名称:Remote-Key-Value-Database,代码行数:26,代码来源:processor.cs
示例2: TestR3
void TestR3()
{
"\n1) Inserting key/value pairs to the database".title();
DBElement<int, string> elem2 = new DBElement<int, string>(); //Add new key/value pairs to the database
elem2.name = "Roger federer";
elem2.descr = "Tennis player";
elem2.timeStamp = DateTime.Now;
elem2.children.AddRange(new List<int> { 3 });
elem2.payload = "Famous tennis player";
db.insert(2, elem2);
DBElement<int, string> elem3 = new DBElement<int, string>();
elem3.name = "Usain Bolt";
elem3.descr = "Athelte";
elem3.timeStamp = DateTime.Now;
elem3.children.AddRange(new List<int> { 1 });
elem3.payload = "Fastest in the world";
db.insert(3, elem3);
DBElement<int, string> elem4 = new DBElement<int, string>();
elem4.name = "Saina Nehwal";
elem4.descr = "Badminton Player";
elem4.timeStamp = DateTime.Now;
elem4.children.AddRange(new List<int> { 2 });
elem4.payload = "Famous badminton player";
db.insert(4, elem4);
db.showDB();
WriteLine();
"\n2) Removing key 4 from the database".title();
db.delete(4);
db.showDB();
WriteLine();
}
开发者ID:rakeshh91,项目名称:Android-Projects,代码行数:34,代码来源:TestExec.cs
示例3: key_value_search
/* Defining a query using lambda function to search specific key
*/
public void key_value_search(DBEngine<int, DBElement<int, string>> db, IQuery<int, DBElement<int, string>> i_query, QueryEngine<int, DBElement<int, string>> qe )
{
"Query for value with specified key (key = 2):".title();
WriteLine();
int key_to_search = 2;
Func<int, string, bool> keyValueSearch = (int key, string search) => //lambda function
{
if (!db.Keys().Contains(key))
return false;
else
{
if (key == int.Parse(search))
{
DBElement<int, string> ele = new DBElement<int, 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(keyValueSearch, key_to_search.ToString(), out i_query);
WriteLine();
foreach (var key in i_query.Keys())
{
DBElement<int, string> temp = new DBElement<int, string>();
i_query.getValue(key, out temp);
WriteLine("key : {0}", key);
temp.showElement();
WriteLine();
}
}
开发者ID:yogeshchaudhari16991,项目名称:NoSQLDatabase,代码行数:34,代码来源:QueryPredicate.cs
示例4: 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
示例5: testDBlement
public void testDBlement()
{
Write("\n --- Test DBElement<int,string> ---");
DBElement<int, string> elem1 = new DBElement<int, string>();
elem1.payload = "a payload";
Write(elem1.showElement<int, string>());
WriteLine();
DBElement<int, string> elem2 = new DBElement<int, string>("Darth Vader", "Evil Overlord");
elem2.payload = "The Empire strikes back!";
Write(elem2.showElement<int, string>());
WriteLine();
var elem3 = new DBElement<int, string>("Luke Skywalker", "Young HotShot");
elem3.children.AddRange(new List<int> { 1, 5, 23 });
elem3.payload = "X-Wing fighter in swamp - Oh oh!";
Write(elem3.showElement<int, string>());
WriteLine();
Write("\n --- Test DBEngine<int,DBElement<int,string>> ---");
int key = 0;
Func<int> keyGen = () => { ++key; return key; }; // anonymous function to generate keys
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.show<int, DBElement<int, string>, string>();
WriteLine();
}
开发者ID:rakeshh91,项目名称:Android-Projects,代码行数:35,代码来源:DBEngineTest.cs
示例6: Server
public Server()
{
elem = new DBElement<int, string>();
strElem = new DBElement<string, List<string>>();
rh = new RequestHandler();
tot = new Hashtable();
}
开发者ID:darshanmp,项目名称:Remote-NoSQL-DB,代码行数:7,代码来源:Server.cs
示例7: 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
示例8: XMLWrite
public void XMLWrite(DBEngine<int, DBElement<int, string>> db, out string pathname)
{
pathname = "xmlDoc.xml";
// The root element is nosqldb or nosqldbLOS, which we can say, is the name
// of the database of the corresponding type. The declaration is important
// from an XML parser point of view.
DBElement<int, string> Val = new DBElement<int, string>();
XDocument doc = new XDocument(new XElement("nosqldb"));
doc.Declaration = new XDeclaration("1.0", "utf - 8", "yes");
XElement keyType = new XElement("keytype", "int");
XElement payloadType = new XElement("payloadtype", "string");
doc.Root.Add(keyType);
doc.Root.Add(payloadType);
foreach (var key in db.Keys())
{
XElement keyNode = new XElement("key", key);
db.getValue(key, out Val);
XElement elementNode = new XElement("element");
elementNode.Add(new XElement("name", Val.name));
elementNode.Add(new XElement("descr", Val.descr));
elementNode.Add(new XElement("timeStamp", Val.timeStamp.ToString()));
XElement childrenNode = new XElement("children"); //since children is List<Key>
foreach (var item in Val.children)
{
childrenNode.Add(new XElement("key", item));
}
elementNode.Add(childrenNode);
elementNode.Add(new XElement("payload", Val.payload)); //since payload is string for this type of database
doc.Root.Add(keyNode);
doc.Root.Add(elementNode);
}
doc.Save(pathname);
}
开发者ID:ayushkhemka,项目名称:NoSQL_database,代码行数:34,代码来源:PersistEngine.cs
示例9: TestR3
void TestR3()//addition and deletion of key/value pairs
{
"Demonstrating Requirement #3".title();
WriteLine();
Write("\n --- Test addition of key/value pairs Start---");
WriteLine();
DBElement<int, string> elem1 = new DBElement<int, string>();
elem1.name = "element#1";//add a new key/value pairs
elem1.descr = "test element#1";
elem1.timeStamp = DateTime.Now;
elem1.children.AddRange(new List<int>{ 6, 8 });
elem1.payload = "elem#1's payload";
elem1.showElement();
db.insert(2, elem1);
Write("\n\n Show key/value pairs in data base:\n");
db.showDB();
WriteLine();
Write("\n --- Test addition of key/value pairs End---");
WriteLine();
Write("\n --- Test deletion of key/value pairs Start---");
WriteLine();
db.delete(1);//delete an existing key/value pairs
Write("\n\n Show key/value pairs in data base:\n");
db.showDB();
WriteLine();
db.delete(100);//try to delete a key/value pairs that doesn't exist
Write("\n --- Test deletion of key/value pairs End---");
WriteLine();
}
开发者ID:lxinghe,项目名称:681project4,代码行数:31,代码来源:TestExec.cs
示例10: Test2
private static void Test2(out DBElement<string, string> newelem1, out DBElement<string, string> newerelem1, out DBElement<string, string> newerelem2)
{
newelem1 = new DBElement<string, string>();
newelem1.name = "newelem1";
newelem1.descr = "test new type";
newelem1.payload = "one";
//Load the second element
newerelem1 = new DBElement<string, string>();
newerelem1.name = "newerelem1";
newerelem1.descr = "better formatting";
newerelem1.payload = "alpha";
//Load the third element
newerelem2 = new DBElement<string, string>();
newerelem2.name = "newerelem2";
newerelem2.descr = "better formatting";
newerelem2.children.AddRange(new List<string> { "first", "second" });
newerelem2.payload = "a";
if (verbose)
{
Write("\n --- Test DBElement<string,List<string>> ---");
WriteLine();
newelem1.showEnumerableElement(); //Display the element
WriteLine();
newerelem1.showEnumerableElement(); //Display the element
WriteLine();
newerelem2.showEnumerableElement();
WriteLine();
}
}
开发者ID:darshanmp,项目名称:Remote-NoSQL-DB,代码行数:29,代码来源:DisplayTest.cs
示例11: Main
static void Main(string[] args)
{
WriteLine("Testing DBExtensions Package\n");
WriteLine();
//Insert first element
Write("\n --- Test DBElement<int,string> ---");
DBElement<int, string> elem1 = new DBElement<int, string>();
elem1.payload = "a payload";
Write(elem1.showElement<int, string>());
//Insert first element into DB
DBEngine<int, DBElement<int, string>> dbs = new DBEngine<int, DBElement<int, string>>();
dbs.insert(1, elem1);
dbs.show<int, DBElement<int, string>, string>();
WriteLine();
//Insert first element into String Key/Value DB
Write("\n --- Test DBElement<string,List<string>> ---");
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");
}
开发者ID:darshanmp,项目名称:Remote-NoSQL-DB,代码行数:30,代码来源:DBExtensionsTest.cs
示例12: writeXML
public void writeXML()
{
if(db1.emptyDictionary())
Write("\n\nThe database is empty.\n");
else{//if the dictionary is not empty store key/value pairs into a XML file
DBElement<int, string> temp = new DBElement<int, string>();
IEnumerable<int> keys = db1.Keys();
XDocument xml = new XDocument();
xml.Declaration = new XDeclaration("1.0", "utf-8", "yes");
XElement noSqlDb = new XElement("noSqlDb");
xml.Add(noSqlDb);
XElement keytype = new XElement("keytype", "int");
XElement payloadtype = new XElement("payloadtype", "string");
noSqlDb.Add(keytype);
noSqlDb.Add(payloadtype);
foreach(var i in keys)
{
db1.getValue(2, out temp);
XElement key = new XElement("key", ("key"+i));
noSqlDb.Add(key);//noSqlDb's children
XElement element = new XElement("element");
noSqlDb.Add(element);//noSqlDb's children
XElement name = new XElement("name", temp.name);//name of the element
element.Add(name);
XElement descr = new XElement("descr", temp.descr);//description of the element
element.Add(descr);
XElement timeStamp = new XElement("timeStamp", temp.timeStamp);//timeStamp of the element
element.Add(timeStamp);
if(temp.children.Count!=0)//children of the element
{
XElement children = new XElement("children");
element.Add(children);
foreach(var j in temp.children)
{
XElement childkey = new XElement("key", ("key"+j));
children.Add(childkey);
}
}
XElement payload = new XElement("payload", temp.payload);//payload of the element
element.Add(payload);
}
Console.Write("\n{0}\n", xml.Declaration);
Console.Write(xml.ToString());
Console.Write("\n\n");
xml.Save(@"C:\Users\lxinghe\Downloads\Project2Starter\Test.xml");
db1.emptyDBEngine();//empty DBEngine
}
}
开发者ID:gerent9196,项目名称:681project2,代码行数:59,代码来源:PersistToXML.cs
示例13: RequestHandler
public RequestHandler()
{
sb = new StringBuilder();
db = new DBEngine<int, DBElement<int, string>>();
query = new QueryEngine<int, DBElement<int, string>>();
dbString = new DBEngine<string, DBElement<string, List<string>>>();
strElem = new DBElement<string, List<string>>();
}
开发者ID:darshanmp,项目名称:Remote-NoSQL-DB,代码行数:8,代码来源:RequestHandler.cs
示例14: writeXML
public void writeXML(string path)
{
if(db1.emptyDictionary())
Write("\n\nThe database is empty.\n");
else{//if the dictionary is not empty store key/value pairs into a XML file
DBElement<int, string> temp = new DBElement<int, string>();
IEnumerable<int> keys = db1.Keys();
xml.Declaration = new XDeclaration("1.0", "utf-8", "yes");
XElement noSqlDb = new XElement("noSqlDb");
xml.Add(noSqlDb);
XElement keytype = new XElement("keytype", "int");
XElement payloadtype = new XElement("payloadtype", "string");
noSqlDb.Add(keytype);
noSqlDb.Add(payloadtype);
foreach(var i in keys)
{
db1.getValue(i, out temp);
XElement key = new XElement("key", ("key"+i));
noSqlDb.Add(key);//noSqlDb's children
XElement element = new XElement("element");
noSqlDb.Add(element);//noSqlDb's children
XElement name = new XElement("name", temp.name);//name of the element
element.Add(name);
XElement descr = new XElement("descr", temp.descr);//description of the element
element.Add(descr);
XElement timeStamp = new XElement("timeStamp", temp.timeStamp);//timeStamp of the element
element.Add(timeStamp);
if(temp.children.Count!=0)//children of the element
{
XElement children = new XElement("children");
element.Add(children);
foreach(var j in temp.children)
{
XElement childkey = new XElement("key", ("key"+j));
children.Add(childkey);
}
}
XElement payload = new XElement("payload", temp.payload);//payload of the element
element.Add(payload);
}
xml.Save(path);
}
}
开发者ID:lxinghe,项目名称:681project4,代码行数:54,代码来源:PersistToXML.cs
示例15: EditData
/// <summary>
/// Editing Data while updating.This returns element to be modified
/// </summary>
/// <param name="dbStore"></param>
/// <param name="key"></param>
/// <param name="element"></param>
/// <param name="Operation"></param>
/// <param name="error"></param>
/// <returns></returns>
public bool EditData(ref DBEngine<int, DBElement<int, string>> dbStore, int key, out DBElement<int, string> element, string Operation, out string error)
{
try
{
DBElement<int, string> elem = new DBElement<int, string>();
error = "success"; bool success = true;
success = dbStore.getValue(key, out element);
if (success != true)
{
error = "Key not found in DB";
return false;
}
elem = element;
switch (Operation)
{
case "EditName": //Modify Name
{
element.name = elem.name;
break;
}
case "EditDescription": //Modify Description
{
element.descr = elem.descr;
break;
}
case "EditPayload": //Modify Payload
{
element.payload = elem.payload;
break;
}
case "EditChildren": //Modify Children
{
element.children = new List<int>();
element.children = elem.children;
break;
}
case "EditKeyNotValid": //Key editing is not valid
{
error = "Editing of Key is not allowed";
return false;
}
default:
break;
}
return true;
}
catch (Exception ex)
{
throw new CustomException("error at itemeditor editdata", ex);
}
}
开发者ID:darshanmp,项目名称:Remote-NoSQL-DB,代码行数:60,代码来源:ItemEditor.cs
示例16: performOperations
public void performOperations(DBEngine<string, DBElement<string, List<string>>> testDict, DBElement<string, List<string>> value)
{ /*----------Perform operations as per the input given in the XML document--------------*/
if (value.operation == "addition")
{
testDict.insert(value.key, value); //insert the key/value pairs to the main database
string s = "Database after inserting key " + value.key + " is";
printDatabase(testDict, s);
}
if (value.operation == "edit")
{
testDict.saveValue(value.key, value); //edit the value for the given key
string s = "Database after editing key " + value.key + " is";
printDatabase(testDict, s);
}
if (value.operation == "delete")
{
testDict.delete(value.key); //delete the key/value pair
string s = "Database after deleting key " + value.key + " is";
printDatabase(testDict, s);
}
if (value.operation == "persist database")
{
PersistEngine<string, DBElement<string, List<string>>> persist = new PersistEngine<string, DBElement<string, List<string>>>(testDict);
var keys = testDict.Keys();
persist.persistToXMLListPayload(keys);
printDatabase(testDict, "Persisted database is:");
}
if (value.operation == "Query value")
{
DBElement<string, List<string>> valueOfKey = testDict.getValueOfKey(value.key);
printQuery("Querying the database for value of key " + value.key + " is");
Console.WriteLine("\n\nThe value of the Key {0} is:\n", value.key);
valueOfKey.showEnumerableElement();
}
if (value.operation == "Query children")
{
QueryEngine<string, DBElement<string, List<string>>> qEngine = new QueryEngine<string, DBElement<string, List<string>>>(testDict);
printQuery("Querying the database for value of key " + value.key + " is");
List<string> children = qEngine.getChildrenOfKey(value.key);
Console.WriteLine("\nThe children of the Key {0} are:\n", value.key);
displayChildren(children);
}
if (value.operation == "Augment database")
{
PersistEngine<string, DBElement<string, List<string>>> persist = new PersistEngine<string, DBElement<string, List<string>>>(testDict);
string fileName = "C:\\Users\\rakeshh91\\Documents\\Rakesh Documents\\Class Materials\\SMA\\Assignments\\Assignment 4 - Implementation\\CommPrototype\\augmentDatabase.xml";
persist.augmentDatabaseFromXMLStringList(testDict, fileName);
printDatabase(testDict, "Database after augmenting is:");
}
}
开发者ID:rakeshh91,项目名称:Android-Projects,代码行数:50,代码来源:Server.cs
示例17: Main
static void Main(string[] args)
{
Console.WriteLine("Started testing of QueryEngineTest\n");
DBElement<int, string> elem = new DBElement<int, string>();
int key = 54;
elem.name = "2015 Maserati GranTurismo";
elem.descr = "Ferrari FF new model 2015";
elem.timeStamp = DateTime.Now;
elem.children.AddRange(new List<int> { 1, 2, 3, 4 });
elem.payload = "Make:Maserati;Model:Maserati GranTurismo;Color:Green;Year:2015;";
key = 54;
db.insert(54, elem);
bool status = query.getKey(db, key, out elem);
Console.WriteLine("Obtained the key successfully\n {0} ,{1}, {2} ,{3} \n", elem.name, elem.payload, elem.timeStamp, elem.descr);
}
开发者ID:darshanmp,项目名称:Remote-NoSQL-DB,代码行数:15,代码来源:QueryEngineTest.cs
示例18: TestR2
void TestR2()
{
"Demonstrating Requirement #2".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);
Write("\n\n Show key/value pairs in data base:\n");
db.showDB();
WriteLine();
}
开发者ID:lxinghe,项目名称:681project4,代码行数:15,代码来源:TestExec.cs
示例19: 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
示例20: query
//private DBEngine<int, DBElement<int, List<int>>> keysFromQuery = new DBEngine<int, DBElement<int, List<int>>>();
public string query(XDocument message) {//method used to handle queries
string reply;
List<int> children = new List<int>();
XElement element = message.Element("Message").Element("QueryType");
Query<int, int, string> query1 = new Query<int, int, string>(db);
switch(element.Value){
case "the value of specified key":
element = message.Element("Message").Element("Key");
DBElement<int, string> elem = new DBElement<int, string>();
query1.checkValueByKey(Int32.Parse(element.Value), out elem);
reply = ("The value of specified key " + element.Value + " is\n" + elem.showElement<int, string>());
break;
case "the children of specified key":
element = message.Element("Message").Element("Key");
children = query1.childrenByKey(Int32.Parse(element.Value));
reply = ("The children of specified key " + element.Value + " is\n");
reply = this.addChildToStr(children, reply);
break;
case "the keys share a same pattern":
element = message.Element("Message").Element("Pattern");
Query<string, int, string> queryString = new Query<string, int, string>(dbString);
List<string> keyString = new List<string>();
keyString = queryString.keysWithPattern(dbString,element.Value);
reply = ("The keys share a same pattern \"" + element.Value + "\" is\n");
foreach(var key in keyString)
reply += (String.Format("{0}\n", key.ToString()));
break;
case "the keys share same pattern in their metadata":
element = message.Element("Message").Element("Pattern");
children = query1.keysSameMdataPattern(element.Value);
reply = ("The keys share same pattern " + element.Value + " is\n");
reply = this.addChildToStr(children, reply);
break;
case "the keys of value created in the same time interval":
List<DateTime> dts = new List<DateTime>();
dts = this.getDTS(message);
children = query1.keysSameTinterval(dts[0], dts[1]);
reply = ("The keys of value created in the same time interval between " + dts[0].ToString() + " and " + dts[1]).ToString()+"\n";
reply = this.addChildToStr(children, reply);
break;
default:
reply = ("Invalid editing type.");
break;
}
return reply;
}
开发者ID:lxinghe,项目名称:681project4,代码行数:49,代码来源:Server.cs
注:本文中的DBElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论