BulkSqlLoader.Core 3.0.1

dotnet add package BulkSqlLoader.Core --version 3.0.1
                    
NuGet\Install-Package BulkSqlLoader.Core -Version 3.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BulkSqlLoader.Core" Version="3.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BulkSqlLoader.Core" Version="3.0.1" />
                    
Directory.Packages.props
<PackageReference Include="BulkSqlLoader.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BulkSqlLoader.Core --version 3.0.1
                    
#r "nuget: BulkSqlLoader.Core, 3.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BulkSqlLoader.Core@3.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BulkSqlLoader.Core&version=3.0.1
                    
Install as a Cake Addin
#tool nuget:?package=BulkSqlLoader.Core&version=3.0.1
                    
Install as a Cake Tool

BulkSqlLoader

A library for massive insertion of queries with multiple parameters

BulkSqlLoader allows you to easily handle large command queries with multiple parameters and bypass the limitations of various servers

Here are the limit parameter numbers for some servers:

Ingres : 1024
Microsoft Access : 768
Oracle : 32767
PostgreSQL : 32767
SQLite : 999
SQL Server : 2100 (depending on the version)
Sybase ASE : 2000

Taken from:
- https://www.jooq.org/doc/3.12/manual/sql-building/dsl-context/custom-settings/settings-inline-threshold/

Initialization:

            var connectionString = _connectionStrings.GetSection("Mysql:connectionString").Value;
            var paramsBatchLimit = Convert.ToInt32(_envirnoment.GetSection("paramsBatchLimit").Value);

            IDbConnection conn = new SqlConnection(connectionString);

            _bulkSqlLoader = new BulkSqlLoader(
                conn,
                throwException: true, 
                paramsBatchLimit: paramsBatchLimit); //for example: sqlserver 2017 express has 2100

Use:

           try
           {
               await _bulkSqlLoader.ExecuteNonQueriesAsync(nonQueries, parameters)
                   .ConfigureAwait(false);
           }
           catch (Exception ex)
           {
              //excpetion handler code
           }

The following example is just to show how the "nonQueries", "parameters" args can be structured

            /*example: generate 200000 non queries with 1M random parameters*/
            
            Random rng = new();
            int queryNumber = rng.Next(200000);
            
            const int columnsTestTable = 5;

            int parametersIndex = -1;
            
            var sb = new StringBuilder();
            for (int i = 0; i < queryNumber; ++i)
            {
                string nonQuery =
                    $"INSERT INTO YOUR_TABLE " +
                    "(FIELD_1, FIELD_2, FIELD_3, FIELD_4, FIELD_5) VALUES (" +
                    $"@p{++parametersIndex}, " +
                    $"@p{++parametersIndex}, " +
                    $"@p{++parametersIndex}, " +
                    $"@p{++parametersIndex}, " +
                    $"@p{++parametersIndex}) ";

                sb.AppendLine(nonQuery);
            }

            var nonQueries = sb.ToString().Split("\r\n");

            nonQueries = nonQueries
                .Where((_, i) => i != nonQueries.Length - 1)
                .ToArray();

            var parameters = new object[queryNumber * columnsTestTable]
                .Select((_, i) => (i as object))
                .ToArray();

It is possible to query the db in a generic way with the executeQuery methods:

	IEnumerable<TEST_TABLE> results = bulkSqlLoader.ExecuteQuery<TEST_TABLE>(query);

or more generically:

	IEnumerable<object[]> results = bulkSqlLoader.ExecuteQuery(query);

This library is NOT thread safe, the connection is shared, so avoid code like:

	while (conditionTrue)
	{
	     _bulkSqlLoader.ExecuteNonQueriesAsync(nonQueries, parameters)
	        .ConfigureAwait(false); 
	}

or:

        var t = Task.Run(() => _bulkSqlLoader.ExecuteQueries<TEST_TABLE>(nonQueries, parameters);
        vat t2 = Task.Run(() => _bulkSqlLoader.ExecuteNonQueries(nonQueries, parameters);
                
        Task.WhenAll(t1, t2);
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.1 123 3/8/2026