本文整理汇总了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);
}