using System.Collections.Generic;
using System.Data.SqlClient;
public static void Main()
public static void Execute()
var list = new List<Customer>();
list.Add(new Customer() { Name = "Customer_C_Inserted", Description = "Description_Customer_C_Inserted", IsActive = false });
list.Add(new Customer() { CustomerID = 1, Name = "Customer_A_Updated", Description = "Description_Customer_A_Updated", IsActive = false });
list.Add(new Customer() { CustomerID = 2, Name = "Customer_B_Updated", Description = "Description_Customer_B_Updated", IsActive = false });
var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServer());
List<AuditEntry> auditEntries = new List<AuditEntry>();
using (var bulk = new BulkOperation(connection))
bulk.DestinationTableName = "Customer";
bulk.AuditMode = AuditModeType.ExcludeAll;
new ColumnMapping<Customer>("CustomerID", true)
AuditMode = ColumnMappingAuditModeType.Include
new ColumnMapping<Customer>("Name")
AuditMode = ColumnMappingAuditModeType.Include
auditEntries = bulk.AuditEntries;
FiddleHelper.WriteTable(auditEntries.SelectMany(x => x.Values));
public int CustomerID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public Boolean IsActive { get; set; }
public static void CreateDatabase()
using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServer()))
using (var command = connection.CreateCommand())
CREATE TABLE [dbo].[Customer] (
[CustomerID] INT IDENTITY (1, 1) NOT NULL,
[Name] NVARCHAR (MAX) NULL,
[Description] NVARCHAR (MAX) NULL,
CONSTRAINT [PK_dbo.Customer] PRIMARY KEY CLUSTERED ([CustomerID] ASC)
command.ExecuteNonQuery();
public static void SeedDatabase()
var list = new List<Customer>();
list.Add(new Customer() { Name = "Customer_A", Description = "Description_Customer_A", IsActive = false });
list.Add(new Customer() { Name = "Customer_B", Description = "Description_Customer_B", IsActive = false });
using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServer()))
using (var bulk = new BulkOperation(connection))
bulk.DestinationTableName = "Customer";