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


C# IDbProvider.CreateCommand方法代码示例

本文整理汇总了C#中IDbProvider.CreateCommand方法的典型用法代码示例。如果您正苦于以下问题:C# IDbProvider.CreateCommand方法的具体用法?C# IDbProvider.CreateCommand怎么用?C# IDbProvider.CreateCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDbProvider的用法示例。


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

示例1: Setup

        public void Setup()
        {
            _dbProvider = DbProviderFactory.GetDbProvider("System.Data.SqlClient");
            _dbProvider.ConnectionString =
                @"Data Source=SPRINGQA;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False";

            IDbCommand command = _dbProvider.CreateCommand();
            command.Connection = _dbProvider.CreateConnection();

            ClearTestData(command);
            CreateTestData(command);
        }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:12,代码来源:StoredProcedureTests.cs

示例2: CreateCommandAndEnlistTransaction

	    /// <summary>
        /// Creates the command.
        /// </summary>
        /// <param name="dbProvider">The dbProvider.</param>
        /// <param name="session">If session is not null, attaches the session's Connection and Transaction to the command and sets the command's Timeout property.</param>
        /// <param name="commandType">Type of the command.</param>
        /// <returns>the command</returns>
        protected virtual IDbCommand CreateCommandAndEnlistTransaction(IDbProvider dbProvider, CommandType commandType, ISession session)
        {
            IDbCommand command = dbProvider.CreateCommand();
            command.CommandType = commandType;

            if (session != null)
            {
                command.Connection = session.Connection;
                SetCommandTimeout(command, session.SessionFactory.DataSource.CommandTimeout);

                // Assign transaction
                if (session.Transaction != null)
                {
                    session.Transaction.Enlist(command);
                }
            }

	        return command;
        }
开发者ID:techvenky,项目名称:mybatisnet,代码行数:26,代码来源:DefaultPreparedCommand.cs

示例3: DbParameters

 /// <summary>
 /// Initializes a new instance of the <see cref="DbParameters"/> class.
 /// </summary>
 public DbParameters(IDbProvider dbProvider)
 {
     this.dbProvider = dbProvider;
     dbCommand = dbProvider.CreateCommand();
     dataParameterCollection = dbCommand.Parameters;
 }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:9,代码来源:DbParameters.cs


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