/// <summary> /// Convenience constructor that support passing in an existing Transaction for an open Connection; whereby /// the Sql DB Schema Loader will be resolved internally using the SqlBulkHelpersSchemaLoaderCache manager. /// NOTE: With this overload the resolve ISqlBulkHelpersDBSchemaLoader will be resolved for this unique Connection, /// as an internally managed cached resource for performance. /// </summary> /// <param name="sqlConnection"></param> /// <param name="sqlTransaction"></param> /// <param name="timeoutSeconds"></param> protected BaseSqlBulkHelper(SqlConnection sqlConnection, SqlTransaction sqlTransaction = null, int timeoutSeconds = DefaultBulkOperationTimeoutSeconds) { //For safety since a Connection was passed in then we generally should immediately initialize the Schema Loader, // because this connection or transaction may no longer be valid later. this.SqlDbSchemaLoader = SqlBulkHelpersSchemaLoaderCache.GetSchemaLoader(sqlConnection, sqlTransaction, true); this.BulkOperationTimeoutSeconds = timeoutSeconds; }
/// <summary> /// Constructor that support passing in an SqlConnection Provider which will enable deferred (lazy) initialization of the /// Sql DB Schema Loader and Schema Definitions internally. the Sql DB Schema Loader will be resolved internally using /// the SqlBulkHelpersSchemaLoaderCache manager for performance. /// NOTE: With this overload the resolve ISqlBulkHelpersDBSchemaLoader will be resolved for this unique Connection, /// as an internally managed cached resource for performance. /// </summary> /// <param name="sqlBulkHelpersConnectionProvider"></param> /// <param name="timeoutSeconds"></param> protected BaseSqlBulkHelper(ISqlBulkHelpersConnectionProvider sqlBulkHelpersConnectionProvider, int timeoutSeconds = DefaultBulkOperationTimeoutSeconds) { this.SqlDbSchemaLoader = SqlBulkHelpersSchemaLoaderCache.GetSchemaLoader(sqlBulkHelpersConnectionProvider); this.BulkOperationTimeoutSeconds = timeoutSeconds; }