SqlBulkCopyCat

Cat Gasp

I set myself a personal goal recently…

publish a Library on NuGet.  So that’s exactly what I’ve done.

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.

Examples

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.

Nuget

You can download the Package from Nuget:

Install-Package SqlBulkCopyCat

Github

The source is available on GitHub:

https://github.com/mjcdev/SqlBulkCopyCat

Please feel free to contribute.

Future

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.

Summary

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).

SqlBulkCopyCatScaled64x64.png

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s