本文整理匯總了C#中BsonDocument.GetEnumerator方法的典型用法代碼示例。如果您正苦於以下問題:C# BsonDocument.GetEnumerator方法的具體用法?C# BsonDocument.GetEnumerator怎麽用?C# BsonDocument.GetEnumerator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BsonDocument
的用法示例。
在下文中一共展示了BsonDocument.GetEnumerator方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CreateReplicaCataGroup
/** \fn void CreateReplicaCataGroup(string hostName, int port, string dbpath,
BsonDocument configure)
* \brief Create the Replica Catalog Group with given options
* \param hostName The host name
* \param port The port
* \param dbpath The database path
* \param configure The configure options
* \exception SequoiaDB.BaseException
* \exception System.Exception
*/
public void CreateReplicaCataGroup(string hostName, int port, string dbpath,
BsonDocument configure)
{
if (hostName == null || port == 0 || dbpath == null)
throw new BaseException("SDB_INVALIDARG");
string command = SequoiadbConstants.ADMIN_PROMPT + SequoiadbConstants.CREATE_CMD + " "
+ SequoiadbConstants.CATALOG + " " + SequoiadbConstants.GROUP;
BsonDocument condition = new BsonDocument();
condition.Add(SequoiadbConstants.FIELD_HOSTNAME, hostName);
condition.Add(SequoiadbConstants.SVCNAME, port.ToString());
condition.Add(SequoiadbConstants.DBPATH, dbpath);
if (configure != null)
{
IEnumerator<BsonElement> it = configure.GetEnumerator();
while (it.MoveNext())
{
BsonElement e = it.Current;
if (e.Name == SequoiadbConstants.FIELD_HOSTNAME ||
e.Name == SequoiadbConstants.SVCNAME ||
e.Name == SequoiadbConstants.DBPATH)
continue;
condition.Add(e.Name, e.Value.AsString);
}
}
BsonDocument dummyObj = new BsonDocument();
SDBMessage rtn = AdminCommand(command, condition, dummyObj, dummyObj, dummyObj);
int flags = rtn.Flags;
if (flags != 0)
throw new BaseException(flags);
}