예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlDataTarget" /> class.
        /// </summary>
        /// <param name="connectionFactory">The connection.</param>
        /// <param name="bulkCopyFactory">The bulk copy factory.</param>
        /// <param name="watermarkService">The watermark service.</param>
        /// <param name="tableName">Name of the table.</param>
        /// <param name="highWatermarkColumn">The high watermark column.</param>
        /// <param name="truncateBeforeLoad">If set to <c>true</c> [truncate before load].</param>
        /// <exception cref="System.ArgumentNullException">If any parameters are null.</exception>
        public SqlDataTarget(IConnectionFactory connectionFactory, IBulkCopyFactory bulkCopyFactory, IHighWatermarkService watermarkService, string tableName, string highWatermarkColumn, bool truncateBeforeLoad)
        {
            if (connectionFactory == null)
            {
                throw new ArgumentNullException("connectionFactory");
            }

            this.connectionFactory = connectionFactory;

            if (bulkCopyFactory == null)
            {
                throw new ArgumentNullException("bulkCopyFactory");
            }

            this.bulkCopyFactory = bulkCopyFactory;

            if (tableName == null)
            {
                throw new ArgumentNullException("tableName");
            }

            this.tableName = tableName;

            if (watermarkService == null)
            {
                throw new ArgumentNullException("watermarkService");
            }

            this.watermarkService = watermarkService;

            this.highWatermarkColumn = highWatermarkColumn;
            this.truncateBeforeLoad  = truncateBeforeLoad;

            this.targetSchema = new Lazy <DataTable>(() => this.GetSchemaTable());
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlDataTargetFacts"/> class.
        /// </summary>
        public SqlDataTargetFacts()
        {
            this.bulkCopyFactory  = Substitute.For <IBulkCopyFactory>();
            this.watermarkService = Substitute.For <IHighWatermarkService>();

            this.nonWatermarkTarget = new SqlDataTarget(this.ConnectionFactory, this.bulkCopyFactory, this.watermarkService, TargetTableName, string.Empty, true);
            this.watermarkedTarget  = new SqlDataTarget(this.ConnectionFactory, this.bulkCopyFactory, this.watermarkService, TargetTableName, "WATERMARK COLUMN", true);
        }