• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CommandInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: TestExecute

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

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

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


示例17: ParseCommand

        private CommandInfo ParseCommand(Alachisoft.NCache.Common.Protobuf.Command command)
        {
            CommandInfo cmdInfo = new CommandInfo();

            Alachisoft.NCache.Common.Protobuf.AddAttributeCommand addAttributeCommand = command.addAttributeCommand;
            cmdInfo.ExpHint = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetExpirationHintObj(addAttributeCommand.absExpiration, 0, serializationContext);
            cmdInfo.Key = addAttributeCommand.key;
            cmdInfo.RequestId = addAttributeCommand.requestId.ToString();

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


示例18: ParseCommand

 //PROTOBUF
 private CommandInfo ParseCommand(Alachisoft.NCache.Common.Protobuf.Command command, ClientManager clientManager)
 {
     CommandInfo cmdInfo = new CommandInfo();
     //HACK:notifMask
     Alachisoft.NCache.Common.Protobuf.RegisterNotifCommand registerNotifCommand = command.registerNotifCommand;
     cmdInfo.RegNotifs = registerNotifCommand.notifMask;
     cmdInfo.RequestId = registerNotifCommand.requestId.ToString();
     cmdInfo.datafilter = registerNotifCommand.datafilter;
     cmdInfo.sequence = registerNotifCommand.sequence;
     return cmdInfo;
 }
开发者ID:javithalion,项目名称:NCache,代码行数:12,代码来源:NotificationRegistered.cs


示例19: Add

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.users.user_amount_log model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into " + databaseprefix + "user_amount_log(");
            strSql.Append("user_id,user_name,type,order_no,trade_no,payment_id,value,remark,status,add_time,complete_time)");
            strSql.Append(" values (");
            strSql.Append("@user_id,@user_name,@type,@order_no,@trade_no,@payment_id,@value,@remark,@status,@add_time,@complete_time)");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@user_id", SqlDbType.Int,4),
                    new SqlParameter("@user_name", SqlDbType.NVarChar,100),
                    new SqlParameter("@type", SqlDbType.NVarChar,50),
                    new SqlParameter("@order_no", SqlDbType.NVarChar,100),
                    new SqlParameter("@trade_no", SqlDbType.NVarChar,100),
                    new SqlParameter("@payment_id", SqlDbType.Int,4),
                    new SqlParameter("@value", SqlDbType.Decimal,5),
                    new SqlParameter("@remark", SqlDbType.NVarChar,500),
                    new SqlParameter("@status", SqlDbType.TinyInt,1),
                    new SqlParameter("@add_time", SqlDbType.DateTime),
                    new SqlParameter("@complete_time", SqlDbType.DateTime),
                    new SqlParameter("@ReturnValue",SqlDbType.Int)};
            parameters[0].Value = model.user_id;
            parameters[1].Value = model.user_name;
            parameters[2].Value = model.type;
            parameters[3].Value = model.order_no;
            parameters[4].Value = model.trade_no;
            parameters[5].Value = model.payment_id;
            parameters[6].Value = model.value;
            parameters[7].Value = model.remark;
            parameters[8].Value = model.status;
            parameters[9].Value = model.add_time;
            parameters[10].Value = model.complete_time;
            parameters[11].Direction = ParameterDirection.Output;

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

            if (model.status > 0)
            {
                StringBuilder strSql2 = new StringBuilder();
                strSql2.Append("update " + databaseprefix + "users set amount=amount+" + model.value);
                strSql2.Append(" where [email protected]");
                SqlParameter[] parameters2 = {
                    new SqlParameter("@id", SqlDbType.Int,4)};
                parameters2[0].Value = model.user_id;
                cmd = new CommandInfo(strSql2.ToString(), parameters2);
                sqllist.Add(cmd);
            }

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


示例20: InterceptCommand

		public void InterceptCommand(Guid transactionId, Type entityType, CommandInfo commandInfo, IDbCommand dbCommand) {
			string message = transactionId.ToString() + " - " + commandInfo.ToString();
			if (dbCommand != null) {
				message += ": " + dbCommand.CommandText;
				for (int index = 0; index < dbCommand.Parameters.Count; index++) {
					if (index == 0) message += "\r\n  ";
					IDbDataParameter parameter = dbCommand.Parameters[index] as IDbDataParameter;
					message += parameter.ParameterName + " = " + parameter.Value + ", ";
				}
			}
			this.log.Info(message);
		}
开发者ID:cnporras,项目名称:wilsonormapper,代码行数:12,代码来源:Log4Interceptor.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CommandLine类代码示例发布时间:2022-05-24
下一篇:
C# CommandId类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap