If you use the same BulkCopyOptions object on two different tables, it silently only inserts the rows into the first table it is used on.
```c#
using (var conn = new DataConnection(/.../))
{
var table1 = conn.CreateTable
var table2 = conn.CreateTable
var bulkCopyOptions = new BulkCopyOptions {MaxBatchSize = 1000};
table1.BulkCopy(bulkCopyOptions,
new[] { new TestClass {TestColumn = 1 } });
table2.BulkCopy(bulkCopyOptions,
new[] { new TestClass {TestColumn = 2 } });
Console.WriteLine(string.Join(",", table1.Select(x => x.TestColumn))); // "1,2"
Console.WriteLine(string.Join(",", table2.Select(x => x.TestColumn))); // ""
}
```
The error is caused by the if statements in the following code:
It's not immediately obvious why these fields need to be on the options object at all, but if they must, then some sort of exception should be thrown if any of the schema information is attempting to be changed on re-use.
linq2db version: 2.6.2
Database Server: SQL Server 2016
Operating system: Windows 10
Framework version: .NET Framework 4.6.2
I have no chance to check for now, but looks like we have PR for this: https://github.com/linq2db/linq2db/pull/1520
Duplicate of #1520
Most helpful comment
I have no chance to check for now, but looks like we have PR for this: https://github.com/linq2db/linq2db/pull/1520