using System.Data.SqlClient;
using System.Collections.Generic;
public static void Main()
var customers = GenerateCustomers(5);
using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServer()))
using (var bulk = new BulkOperation<Customer>(connection))
bulk.DestinationTableName = "Customers";
bulk.BulkInsert(customers);
using (var command = connection.CreateCommand())
var sqlDataAdapter = new SqlDataAdapter(command);
ds.Tables[0].TableName = "1 - Customers";
FiddleHelper.WriteTable(ds.Tables[0]);
public static List<Customer> GenerateCustomers(int count)
List<Customer> list = new List<Customer>();
for(int i = 0; i < count; i++)
list.Add(new Customer() { Name = "Customer_" + i});
public static void GenerateDatabase()
using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServer()))
using (var command = connection.CreateCommand())
[CustomerID] [INT] IDENTITY(1,1) NOT NULL,
[Name] [NVARCHAR](MAX) NULL,
CONSTRAINT [PK_Customers] PRIMARY KEY CLUSTERED
command.ExecuteNonQuery();
public int CustomerID { get; set; }
public string Name { get; set; }