Skip to content

Instantly share code, notes, and snippets.

@paully21
paully21 / gist:7056277
Last active December 25, 2015 23:19 — forked from jferguson/gist:1681480
public static void BulkInsert<T>(string connection, string tableName, IList<T> list, string[] propsToSkip)
{
using (var bulkCopy = new SqlBulkCopy(connection, SqlBulkCopyOptions.TableLock))
{
bulkCopy.BatchSize = list.Count;
bulkCopy.DestinationTableName = tableName;
var table = new DataTable();
var props = TypeDescriptor.GetProperties(typeof(T))
//Dirty hack to make sure we only have system data types