Open gilmishal opened 6 years ago
I have the following test code targeting net47
static void Main(string[] args) { var connection = new SqlConnection(_connectionString); connection.Open(); var collection = new List<AnyType>(); for (int i = 0; i < 2000; i++) { collection.Add(new AnyType { Data = "asdfasr", somethingElse = "casdf" }); } using (var copy = new SqlBulkCopy(connection)) using (var reader = ObjectReader.Create(collection, "Data", "somethingElse")) { copy.DestinationTableName = "anyTable"; copy.WriteToServer(reader); } connection.Close(); } class AnyType { public string somethingElse { get; set; } public string Data { get; set; } }
for some reason the resulting copy inserts the value of somethingElse into Data and inserts nulls in somethingElse
somethingElse
Data
I have the following test code targeting net47
for some reason the resulting copy inserts the value of
somethingElse
intoData
and inserts nulls insomethingElse