/// <summary>
        /// It's recommended to provide an ISqlBulkHelpersConnectionProvider however, this convenience method is now provided for
        /// use cases where only a valid SqlConnection exists but the actual ConnectionString is not available to initialize an
        /// ISqlBulkHelpersConnectionProvider.
        ///
        /// This will retrieve a DB Schema Loader using the existing SqlConnection provided.  This will immediately initialize the DB Schema
        /// definitions from the database when executed, because the SqlConnection is assumed to be valid now, but may not be in
        /// the future when lazy initialization would occur (e.g. a Transaction may be started which would then result in errors).
        /// </summary>
        /// <param name="sqlConnection"></param>
        /// <param name="sqlTransaction"></param>
        /// <returns></returns>
        public static ISqlBulkHelpersDBSchemaLoader GetSchemaLoader(SqlConnection sqlConnection, SqlTransaction sqlTransaction = null, bool initializeImmediately = true)
        {
            //Validate arg is a Static Schema Loader...
            var sqlConnProvider = new SqlBulkHelpersConnectionProxyExistingProvider(
                sqlConnection.AssertArgumentIsNotNull(nameof(sqlConnection)),
                sqlTransaction
                );

            //Use the Proxy Connection provider for the existing connection to get or initialize the DB Schema Loader.
            var schemaLoader = GetSchemaLoader(sqlConnProvider);

            //NOTE: 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.
            if (initializeImmediately)
            {
                schemaLoader.InitializeSchemaDefinitions();
            }

            return(schemaLoader);
        }
 public SqlBulkHelpersConnectionProxyExistingProvider(SqlConnection sqlConnection, SqlTransaction sqlTransaction = null)
 {
     _sqlConnection  = sqlConnection.AssertArgumentIsNotNull(nameof(sqlConnection));
     _sqlTransaction = sqlTransaction;
 }