/// <summary> /// 创建<see cref="GridReaderWapper"/>新实例。 /// </summary> /// <param name="gridReader">被包装的<see cref="IDataReader"/>对象。</param> /// <param name="connection"><see cref="IDataReader"/>对象使用的<see cref="IDbConnection"/>连接对象。</param> /// <param name="inTransaction">当前连接对象是否开启了事务。</param> internal GridReaderWapper(GridReader gridReader, DbConnection connection, bool inTransaction) { ArgAssert.NotNull(gridReader, nameof(gridReader)); ArgAssert.NotNull(connection, nameof(connection)); _gridReader = gridReader; _connection = connection; _inTransaction = inTransaction; }
/// <summary> /// 创建<see cref="ThreadLocalTransactionKeeper"/>的新实例。 /// </summary> /// <param name="dbProviderFactory"><see cref="DbProviderFactory"/>实例。</param> /// <param name="connectionString">初始化数据库连接的连接字符串。</param> /// <param name="commandReadTimeout"> /// 指定事务内的读取命令的默认执行超时时间,当方法没有单独制定超时时,套用此超时值。 /// </param> /// <param name="commandWriteTimeout"> /// 指定事务内的写入命令的默认执行超时时间,当方法没有单独制定超时时,套用此超时值。 /// </param> public ThreadLocalTransactionKeeper( DbProviderFactory dbProviderFactory, string connectionString, int?commandReadTimeout = null, int?commandWriteTimeout = null) { ArgAssert.NotNull(dbProviderFactory, nameof(dbProviderFactory)); ArgAssert.NotNullOrEmptyOrWhitespace(connectionString, nameof(connectionString)); Factory = dbProviderFactory; ConnectionString = connectionString; DefaultReadTimeout = commandReadTimeout; DefaultWriteTimeout = commandWriteTimeout; }