using (SqlBulkCopy sqlbulkcopy = new SqlBulkCopy(da.Connection as SqlConnection, SqlBulkCopyOptions.Default, tran as SqlTransaction))
{
sqlbulkcopy.BatchSize = entityList.Count;
sqlbulkcopy.DestinationTableName = TableName;
DataTable rightsTable = entityList.ToTable();
for (int i = 0; i < rightsTable.Columns.Count; i++)
{
sqlbulkcopy.ColumnMappings.Add(rightsTable.Columns[i].ColumnName, rightsTable.Columns[i].ColumnName);
}
sqlbulkcopy.WriteToServer(rightsTable);
}