Problem: 'BulkCopyReader.GetValue' relies on _members index, not on 'memberMapper.Ordinal', and here, in example, field 'id' is not inside _members, so, we get out of index exception.
To reproduce problem:
create table test
(
id int not null identity(1, 1),
data nvarchar(50),
constraint pk_test primary key(id)
)
public class Test
{
[PrimaryKey, NonUpdatable, Identity]
public int id;
public string data;
}
using (var db = new DbManager())
{
var testlist = new List<Test>();
db.BeginTransaction();
testlist.Add(new Test { data = "1" });
testlist.Add(new Test { data = "2" });
db.InsertBatch(testlist);
db.CommitTransaction();
}
Problem: 'BulkCopyReader.GetValue' relies on _members index, not on 'memberMapper.Ordinal', and here, in example, field 'id' is not inside _members, so, we get out of index exception.
To reproduce problem: