I set myself a personal goal recently…
SqlBulkCopyCat is a configurable wrapper around SqlBulkCopy in .NET for SQL Server, born out of a personal frustration at work of being pushed towards using SQL Server Integration Services (SSIS) for copying large amounts of data between databases with no real alternative for anything robust without the baggage of taking on SSIS dependencies and the associated bloat in the Development Environment.
Up to date examples are available on the GitHub Repository Readme, but the API flow is broadly:
- Create a Config Object (and apply any alterations);
- Create a CopyCat instance and feed it the Config Object;
- Execute Copy().
It currently takes configuration from XML, JSON, and the configuration object model, meaning that:
- your copy configurations can easily be swapped around, meaning that the Copy Action could be hidden behind a service;
- it can be used in scenarios where you may not have a fixed schema at build time, where columns can be optionally specified in lieu of copying the entire table;
- configurations can be version controlled.
You can download the Package from Nuget:
The source is available on GitHub:
Please feel free to contribute.
I’m not quite done with the project just yet, I have a few more features I’d like to add in the short term:
- Notify After X Rows copied, with a delegate being passed into the Configuration;
- Parallel copy of rows where the Table Ordinal is equal;
- Inject some extensibility points to swap out my base implementations.
I was surprised how simple it is to create a Nuget Package, with just a couple of command line executions it was done, including managing the references to external NuGet packages I took a dependency on, (Dapper, Json.NET).