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


C# CommandInfo类代码示例

本文整理汇总了C#中CommandInfo的典型用法代码示例。如果您正苦于以下问题:C# CommandInfo类的具体用法?C# CommandInfo怎么用?C# CommandInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Add

        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(Model.contents.article_attribute_field model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into " + databaseprefix + "article_attribute_field(");
            strSql.Append("name,title,control_type,data_type,data_length,data_place,item_option,default_value,is_required,is_password,is_html,editor_type,valid_tip_msg,valid_error_msg,valid_pattern,sort_id,is_sys)");
            strSql.Append(" values (");
            strSql.Append("@name,@title,@control_type,@data_type,@data_length,@data_place,@item_option,@default_value,@is_required,@is_password,@is_html,@editor_type,@valid_tip_msg,@valid_error_msg,@valid_pattern,@sort_id,@is_sys)");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@name", SqlDbType.NVarChar,100),
                    new SqlParameter("@title", SqlDbType.NVarChar,100),
                    new SqlParameter("@control_type", SqlDbType.NVarChar,50),
                    new SqlParameter("@data_type", SqlDbType.NVarChar,50),
                    new SqlParameter("@data_length", SqlDbType.Int,4),
                    new SqlParameter("@data_place", SqlDbType.TinyInt,1),
                    new SqlParameter("@item_option", SqlDbType.NText),
                    new SqlParameter("@default_value", SqlDbType.NText),
                    new SqlParameter("@is_required", SqlDbType.TinyInt,1),
                    new SqlParameter("@is_password", SqlDbType.TinyInt,1),
                    new SqlParameter("@is_html", SqlDbType.TinyInt,1),
                    new SqlParameter("@editor_type", SqlDbType.TinyInt,1),
                    new SqlParameter("@valid_tip_msg", SqlDbType.NVarChar,255),
                    new SqlParameter("@valid_error_msg", SqlDbType.NVarChar,255),
                    new SqlParameter("@valid_pattern", SqlDbType.NVarChar,500),
                    new SqlParameter("@sort_id", SqlDbType.Int,4),
                    new SqlParameter("@is_sys", SqlDbType.TinyInt,1),
                    new SqlParameter("@ReturnValue",SqlDbType.Int)};
            parameters[0].Value = model.name;
            parameters[1].Value = model.title;
            parameters[2].Value = model.control_type;
            parameters[3].Value = model.data_type;
            parameters[4].Value = model.data_length;
            parameters[5].Value = model.data_place;
            parameters[6].Value = model.item_option;
            parameters[7].Value = model.default_value;
            parameters[8].Value = model.is_required;
            parameters[9].Value = model.is_password;
            parameters[10].Value = model.is_html;
            parameters[11].Value = model.editor_type;
            parameters[12].Value = model.valid_tip_msg;
            parameters[13].Value = model.valid_error_msg;
            parameters[14].Value = model.valid_pattern;
            parameters[15].Value = model.sort_id;
            parameters[16].Value = model.is_sys;
            parameters[17].Direction = ParameterDirection.Output;

            List<CommandInfo> sqllist = new List<CommandInfo>();
            CommandInfo cmd = new CommandInfo(strSql.ToString(), parameters);
            sqllist.Add(cmd);

            //������չ�ֶα���һ��
            StringBuilder strSql2 = new StringBuilder();
            strSql2.Append("alter table " + databaseprefix + "article_attribute_value add " + model.name + " " + model.data_type);
            SqlParameter[] parameters2 = { };
            cmd = new CommandInfo(strSql2.ToString(), parameters2);
            sqllist.Add(cmd);

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[17].Value;
        }
开发者ID:eyren,项目名称:OScms,代码行数:63,代码来源:article_attribute_field.cs

示例2: Process

        public CommandResult Process(CommandInfo info, Repository repository)
        {
            info.CheckArity(0);
            string key = info.Key;

            return new CommandResult(repository.GetValue(key));
        }
开发者ID:ajlopez,项目名称:AjKeyvs,代码行数:7,代码来源:GetValueCommand.cs

示例3: InterceptCommand

		/// <summary>
		/// Implements the <see cref="IInterceptCommand"/> method for O/R mapper command logging.
		/// </summary>
		/// <param name="transactionId">The transaction ID.</param>
		/// <param name="entityType">The entity type.</param>
		/// <param name="commandInfo">The command info.</param>
		/// <param name="dbCommand">The database command parameters.</param>
		public void InterceptCommand(Guid transactionId, Type entityType, CommandInfo commandInfo, IDbCommand dbCommand)
		{
			if (LogProvider.Logger.IsDebugEnabled)
			{
				LogProvider.Logger.Debug(ParseCommand(commandInfo, dbCommand));
			}
		}
开发者ID:cnporras,项目名称:wilsonormapper,代码行数:14,代码来源:ORMapperInterceptor.cs

示例4: ParseCommand

		/// <summary>
		/// Parses the command information provided on construction
		/// to a human-readable format.
		/// </summary>
		/// <returns></returns>
		public static string ParseCommand(CommandInfo commandInfo, IDbCommand dbCommand)
		{
			StringBuilder message = new StringBuilder();
			message.Append(commandInfo.ToString());

			if (dbCommand != null)
			{
				message.Append(": ").Append(dbCommand.CommandText.TrimEnd(lineEnds));

				for (int index = 0; index < dbCommand.Parameters.Count; index++)
				{
					IDbDataParameter parameter = dbCommand.Parameters[index] as IDbDataParameter;
					if (parameter != null)
					{
						message.Append(parameter.ParameterName).Append(" = ").Append(parameter.Value).Append(", ");
					}
				}

				if (dbCommand.Parameters.Count > 0)
				{
					message.Length -= 2;
				}
			}

			return message.ToString();
		}
开发者ID:cnporras,项目名称:wilsonormapper,代码行数:31,代码来源:ORMapperInterceptor.cs

示例5: add

 /// <summary>
 /// Add a new element to the HashTable.
 /// </summary>
 /// <param name="commandInfo"><see cref="CommandInfo"/> to be added.</param>
 private void add(CommandInfo commandInfo)
 {
     int index = hashFunction(commandName: commandInfo.getName());
     if (array[index] != null) {
         index = collisionHandler(index: index);
     }
     array[index] = commandInfo;
 }
开发者ID:nunomota,项目名称:RIPBugs,代码行数:12,代码来源:CommandHashTable.cs

示例6: AsyncCommand

        public void AsyncCommand(string cmd,string parameter)
        {
            var commandInfo = new CommandInfo { Command = cmd, Parameter = parameter};

            var bw = new BackgroundWorker();
            bw.DoWork += AsyncCommandWorker;
            bw.RunWorkerAsync(commandInfo);
        }
开发者ID:Ghawken,项目名称:FrontView,代码行数:8,代码来源:MpcHc.Remote.cs

示例7: CreateCommandWithoutParameters

        public void CreateCommandWithoutParameters()
        {
            CommandInfo info = new CommandInfo("get", "users:1:name", null);

            Assert.AreEqual("get", info.Verb);
            Assert.AreEqual("users:1:name", info.Key);
            Assert.IsNull(info.Parameters);
        }
开发者ID:ajlopez,项目名称:AjKeyvs,代码行数:8,代码来源:CommandInfoTests.cs

示例8: TestRefreshState

      public void TestRefreshState()
      {
         var attacher = new Mock<IAttacher>();
         CommandInfo ci = new CommandInfo();
         ci.AttachTo(attacher.Object);

         ci.RefreshState();
         attacher.Verify(a => a.RefreshState(), Times.Once());
      }
开发者ID:AleksMorozova,项目名称:prizm,代码行数:9,代码来源:CommandInfoTest.cs

示例9: Process

        public CommandResult Process(CommandInfo info, Repository repository)
        {
            info.CheckArity(1);
            string key = info.Key;
            object value = info.Parameters[0];

            repository.SetValue(key, value);
            return ok;
        }
开发者ID:ajlopez,项目名称:AjKeyvs,代码行数:9,代码来源:SetValueCommand.cs

示例10: CreateCommandWithParameters

        public void CreateCommandWithParameters()
        {
            CommandInfo info = new CommandInfo("set", "users:1:id", new object[] { 1ul });

            Assert.AreEqual("set", info.Verb);
            Assert.AreEqual("users:1:id", info.Key);
            Assert.IsNotNull(info.Parameters);
            Assert.AreEqual(1, info.Parameters.Count);
            Assert.AreEqual(1ul, info.Parameters[0]);
        }
开发者ID:ajlopez,项目名称:AjKeyvs,代码行数:10,代码来源:CommandInfoTests.cs

示例11: ParseCommand

        //PROTOBUF
        private CommandInfo ParseCommand(Alachisoft.NCache.Common.Protobuf.Command command, ClientManager clientManager)
        {
            CommandInfo cmdInfo = new CommandInfo();

            Alachisoft.NCache.Common.Protobuf.ClearCommand clearCommand= command.clearCommand;
            cmdInfo.FlagMap = new BitSet((byte)clearCommand.flag);
            cmdInfo.RequestId = clearCommand.requestId.ToString();

            return cmdInfo;
        }
开发者ID:javithalion,项目名称:NCache,代码行数:11,代码来源:ClearCommand.cs

示例12: ParseCommand

        //PROTOBUF
        private CommandInfo ParseCommand(Alachisoft.NCache.Common.Protobuf.Command command, ClientManager clientManager)
        {
            CommandInfo cmdInfo = new CommandInfo();

            Alachisoft.NCache.Common.Protobuf.CountCommand countCommand = command.countCommand;

            cmdInfo.RequestId = countCommand.requestId.ToString();

            return cmdInfo;
        }
开发者ID:javithalion,项目名称:NCache,代码行数:11,代码来源:CountCommand.cs

示例13: AddCommand

 /// <summary>
 ///   Add a command to those which can be invoked from the console.
 /// </summary>
 /// <param name = "command">The string that will make the command execute</param>
 /// <param name = "commandHelp">The message that will show the user how to use the command</param>
 /// <param name = "info">Any information about how the command works or what it does</param>
 /// <param name = "fn"></param>
 public void AddCommand(string command, string commandHelp, string infomessage, CommandDelegate fn)
 {
     CommandInfo info = new CommandInfo{
         command = command,
         commandHelp = commandHelp,
         info = infomessage,
         fn = new List<CommandDelegate> {fn}
     };
     tree.AddCommand(info);
 }
开发者ID:EnricoNirvana,项目名称:Aurora-Sim,代码行数:17,代码来源:CommandConsole.cs

示例14: ParseCommand

        //PROTOBUF
        private CommandInfo ParseCommand(Alachisoft.NCache.Common.Protobuf.Command command, ClientManager clientManager)
        {
            CommandInfo cmdInfo = new CommandInfo();

            Alachisoft.NCache.Common.Protobuf.GetRunningServersCommand getRunningServerCommand = command.getRunningServersCommand;

            cmdInfo.CacheId = getRunningServerCommand.cacheId;
            cmdInfo.IsDotNetClient = getRunningServerCommand.isDotnetClient;
            cmdInfo.RequestId = getRunningServerCommand.requestId.ToString();
            return cmdInfo;
        }
开发者ID:javithalion,项目名称:NCache,代码行数:12,代码来源:GetRunningServersCommand.cs

示例15: TestExecuteWhenCanExecuteIsFalse

      public void TestExecuteWhenCanExecuteIsFalse()
      {
         Mock<ICommand> testCommand = new Mock<ICommand>();
         testCommand.Setup(c => c.CanExecute()).Returns(false);

         CommandInfo ci = new CommandInfo();
         ci.Executor(testCommand.Object);
         ci.Execute();

         testCommand.Verify(c => c.Execute(), Times.Never());
      }
开发者ID:AleksMorozova,项目名称:prizm,代码行数:11,代码来源:CommandInfoTest.cs


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