當前位置: 首頁>>代碼示例>>C#>>正文


C# CommandDocument.ToString方法代碼示例

本文整理匯總了C#中MongoDB.Driver.CommandDocument.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# CommandDocument.ToString方法的具體用法?C# CommandDocument.ToString怎麽用?C# CommandDocument.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MongoDB.Driver.CommandDocument的用法示例。


在下文中一共展示了CommandDocument.ToString方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ExecuteMongoDBCommand

 /// <summary>
 /// 執行數據庫命令
 /// </summary>
 /// <param name="mongoCmd"></param>
 /// <param name="mongoDB"></param>
 /// <returns></returns>
 public static CommandResult ExecuteMongoDBCommand(CommandDocument mongoCmd, MongoDatabase mongoDB)
 {
     CommandResult rtn;
     try
     {
         rtn = mongoDB.RunCommand(mongoCmd);
     }
     catch (MongoCommandException ex)
     {
         rtn = ex.CommandResult;
     }
     RunCommandEventArgs e = new RunCommandEventArgs();
     e.CommandString = mongoCmd.ToString();
     e.RunLevel = PathLv.DatabaseLV;
     e.Result = rtn;
     OnCommandRunComplete(e);
     return rtn;
 }
開發者ID:huohe2009,項目名稱:MagicMongoDBTool,代碼行數:24,代碼來源:MongoDBHelper_RunCommand.cs

示例2: ExecuteMongoSvrCommand

 /// <summary>
 /// 執行MongoCommand
 /// </summary>
 /// <param name="mCommandDocument">命令Doc</param>
 /// <param name="mongoSvr">目標服務器</param>
 /// <returns></returns>
 public static CommandResult ExecuteMongoSvrCommand(CommandDocument mCommandDocument, MongoServer mongoSvr)
 {
     CommandResult mCommandResult;
     try
     {
         mCommandResult = mongoSvr.GetDatabase(DATABASE_NAME_ADMIN).RunCommand(mCommandDocument);
     }
     catch (MongoCommandException ex)
     {
         mCommandResult = ex.CommandResult;
     }
     RunCommandEventArgs e = new RunCommandEventArgs();
     e.CommandString = mCommandDocument.ToString();
     e.RunLevel = PathLv.ServerLV;
     e.Result = mCommandResult;
     OnCommandRunComplete(e);
     return mCommandResult;
 }
開發者ID:qq33357486,項目名稱:MagicMongoDBTool,代碼行數:24,代碼來源:MongoDBHelper_RunCommand.cs

示例3: ExecuteMongoSvrCommand

 /// <summary>
 ///     執行MongoCommand
 /// </summary>
 /// <param name="mCommandDocument">命令Doc</param>
 /// <param name="mongoSvr">目標服務器</param>
 /// <returns></returns>
 public static CommandResult ExecuteMongoSvrCommand(CommandDocument mCommandDocument, MongoServer mongoSvr)
 {
     CommandResult mCommandResult;
     try
     {
         mCommandResult = mongoSvr.GetDatabase(MongoDbHelper.DATABASE_NAME_ADMIN).RunCommand(mCommandDocument);
     }
     catch (MongoCommandException ex)
     {
         mCommandResult = ex.CommandResult;
     }
     var e = new RunCommandEventArgs
     {
         CommandString = mCommandDocument.ToString(),
         RunLevel = MongoDbHelper.PathLv.InstanceLv,
         Result = mCommandResult
     };
     OnCommandRunComplete(e);
     return mCommandResult;
 }
開發者ID:EricBlack,項目名稱:MagicMongoDBTool,代碼行數:26,代碼來源:MongoDBHelper_Command_Run.cs

示例4: ExecuteMongoDBCommand

 /// <summary>
 ///     執行數據庫命令
 /// </summary>
 /// <param name="mongoCmd"></param>
 /// <param name="mongoDB"></param>
 /// <returns></returns>
 public static CommandResult ExecuteMongoDBCommand(CommandDocument mongoCmd, MongoDatabase mongoDB)
 {
     CommandResult mCommandResult;
     try
     {
         mCommandResult = mongoDB.RunCommand(mongoCmd);
     }
     catch (MongoCommandException ex)
     {
         mCommandResult = ex.CommandResult;
     }
     var e = new RunCommandEventArgs
     {
         CommandString = mongoCmd.ToString(),
         RunLevel = MongoDbHelper.PathLv.DatabaseLv,
         Result = mCommandResult
     };
     OnCommandRunComplete(e);
     return mCommandResult;
 }
開發者ID:EricBlack,項目名稱:MagicMongoDBTool,代碼行數:26,代碼來源:MongoDBHelper_Command_Run.cs

示例5: ExecuteMongoColCommand

 /// <summary>
 ///     數據集命令
 /// </summary>
 /// <param name="Command">命令關鍵字</param>
 /// <param name="mongoCol">數據集</param>
 /// <param name="ExtendInfo">命令參數</param>
 /// <returns></returns>
 public static CommandResult ExecuteMongoColCommand(String Command, MongoCollection mongoCol,
     BsonDocument ExtendInfo)
 {
     var ExecuteCommand = new CommandDocument
     {
         {Command, mongoCol.Name},
     };
     foreach (BsonElement item in ExtendInfo.Elements)
     {
         ExecuteCommand.Add(item);
     }
     CommandResult mCommandResult = mongoCol.Database.RunCommand(ExecuteCommand);
     var e = new RunCommandEventArgs
     {
         CommandString = ExecuteCommand.ToString(),
         RunLevel = MongoDbHelper.PathLv.CollectionLv,
         Result = mCommandResult
     };
     OnCommandRunComplete(e);
     return mCommandResult;
 }
開發者ID:EricBlack,項目名稱:MagicMongoDBTool,代碼行數:28,代碼來源:MongoDBHelper_Command_Run.cs

示例6: ExecuteMongoSvrCommand

 /// <summary>
 ///     執行MongoCommand
 /// </summary>
 /// <param name="mCommandDocument">命令Doc</param>
 /// <param name="mongoSvr">目標服務器</param>
 /// <returns></returns>
 public static CommandResult ExecuteMongoSvrCommand(CommandDocument mCommandDocument, MongoServer mongoSvr)
 {
     CommandResult mCommandResult;
     try
     {
         mCommandResult = mongoSvr.GetDatabase(ConstMgr.DatabaseNameAdmin).RunCommand(mCommandDocument);
     }
     catch (MongoCommandException ex)
     {
         mCommandResult = new CommandResult(ex.Result);
     }
     var e = new RunCommandEventArgs
     {
         CommandString = mCommandDocument.ToString(),
         RunLevel = EnumMgr.PathLevel.Instance,
         Result = mCommandResult
     };
     OnCommandRunComplete(e);
     return mCommandResult;
 }
開發者ID:jango2015,項目名稱:MongoCola,代碼行數:26,代碼來源:CommandHelper.cs

示例7: ExecuteMongoDBCommand

 /// <summary>
 /// 
 /// </summary>
 /// <param name="mongoCmd"></param>
 /// <param name="mongoDb"></param>
 /// <returns></returns>
 public static CommandResult ExecuteMongoDBCommand(CommandDocument mongoCmd, IMongoDatabase mongoDb)
 {
     CommandResult mCommandResult = null;
     try
     {
         var t = Task.Run(
             async () => { mCommandResult = await mongoDb.RunCommandAsync<CommandResult>(mongoCmd); }
             );
         t.Wait();
     }
     catch (MongoCommandException ex)
     {
         mCommandResult = new CommandResult(ex.Result);
     }
     var e = new RunCommandEventArgs
     {
         CommandString = mongoCmd.ToString(),
         RunLevel = EnumMgr.PathLevel.Database,
         Result = mCommandResult
     };
     OnCommandRunComplete(e);
     return mCommandResult;
 }
開發者ID:jango2015,項目名稱:MongoCola,代碼行數:29,代碼來源:CommandHelper.cs

示例8: ExecuteMongoColCommand

 /// <summary>
 ///     數據集命令
 /// </summary>
 /// <param name="command">命令關鍵字</param>
 /// <param name="mongoCol">數據集</param>
 /// <param name="extendInfo">命令參數</param>
 /// <returns></returns>
 public static CommandResult ExecuteMongoColCommand(string command, MongoCollection mongoCol,
     BsonDocument extendInfo)
 {
     var executeCommand = new CommandDocument
     {
         {command, mongoCol.Name}
     };
     foreach (var item in extendInfo.Elements)
     {
         executeCommand.Add(item);
     }
     var mCommandResult = mongoCol.Database.RunCommand(executeCommand);
     var e = new RunCommandEventArgs
     {
         CommandString = executeCommand.ToString(),
         RunLevel = EnumMgr.PathLevel.Collection,
         Result = mCommandResult
     };
     OnCommandRunComplete(e);
     return mCommandResult;
 }
開發者ID:jango2015,項目名稱:MongoCola,代碼行數:28,代碼來源:CommandHelper.cs

示例9: ExecuteMongoSvrCommand

 /// <summary>
 ///     執行MongoCommand
 /// </summary>
 /// <param name="mCommandDocument">命令Doc</param>
 /// <param name="mongoSvr">目標服務器</param>
 /// <returns></returns>
 public static CommandResult ExecuteMongoSvrCommand(CommandDocument mCommandDocument, MongoServer mongoSvr)
 {
     CommandResult mCommandResult = null;
     try
     {
         if (mongoSvr.DatabaseExists(ConstMgr.DatabaseNameAdmin))
         {
             //Repl的時候,會發生超時問題
             mCommandResult = mongoSvr.GetDatabase(ConstMgr.DatabaseNameAdmin).RunCommand(mCommandDocument);
         }
         else
         {
             //Replset的時候,沒有Admin數據庫
             BsonDocument AdminDatabaseNotFound = new BsonDocument();
             AdminDatabaseNotFound.Add("errmsg", "Admin Database Not Found");
             mCommandResult = new CommandResult(AdminDatabaseNotFound);
         }
     }
     catch (MongoCommandException ex)
     {
         mCommandResult = new CommandResult(ex.Result);
     }
     catch (TimeoutException)
     {
         BsonDocument TimeOutDocument = new BsonDocument();
         TimeOutDocument.Add("errmsg", "TimeoutException");
         mCommandResult = new CommandResult(TimeOutDocument);
     }
     var e = new RunCommandEventArgs
     {
         CommandString = mCommandDocument.ToString(),
         RunLevel = EnumMgr.PathLevel.Instance,
         Result = mCommandResult
     };
     OnCommandRunComplete(e);
     return mCommandResult;
 }
開發者ID:magicdict,項目名稱:MongoCola,代碼行數:43,代碼來源:CommandExecute.cs

示例10: ExecuteMongoColCommand

 /// <summary>
 /// 數據集命令
 /// </summary>
 /// <param name="Command">命令關鍵字</param>
 /// <param name="mongoCol">數據集</param>
 /// <param name="ExtendInfo">命令參數</param>
 /// <returns></returns>
 public static CommandResult ExecuteMongoColCommand(String Command, MongoCollection mongoCol, BsonDocument ExtendInfo)
 {
     var textSearchCommand = new CommandDocument
     {
         { Command, mongoCol.Name },
     };
     foreach (var item in ExtendInfo.Elements)
     {
         textSearchCommand.Add(item);
     }
     var mCommandResult = mongoCol.Database.RunCommand(textSearchCommand);
     RunCommandEventArgs e = new RunCommandEventArgs();
     e.CommandString = textSearchCommand.ToString();
     e.RunLevel = PathLv.CollectionLV;
     e.Result = mCommandResult;
     OnCommandRunComplete(e);
     return mCommandResult;
 }
開發者ID:huchao007,項目名稱:MagicMongoDBTool,代碼行數:25,代碼來源:MongoDBHelper_Command_Run.cs


注:本文中的MongoDB.Driver.CommandDocument.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。