How to work with items in the bcpToolkit .NET library

To get started create a new Visual Studio project and reference the bcpDevKit assembly in your project. then add the bcpToolkit namespaces to your project.

to be able to use ".Last()" and ".SelectMany()" further down in this article an additional namespace System.Linq  is required

using bcpDevKit;
using System.Linq;

 Create the bcpService

To create a bcp package first a new bcpServiceBuilder has to be created in which the version and the location where the package gets created is passed. Then the bcpService is built.

var bcpSvcBuilder = new BcpServiceBuilder();
bcpSvcBuilder.Version = BcpVersion._2020;
bcpSvcBuilder.SetPackageLocation("C:\\Temp\\MyBcpPackage");
var bcpService = bcpSvcBuilder.Build();

Create the bcp package

With following code the bcp package can be created in the location that you specified at the beginning. Please note the the location must exist

bcpService.Flush();