Description
Bug Description
I get an Object reference not set to an instance of an object
error when calling BulkMerge()
(I haven't tried other methods).
I have tried calling both .BulkMerge<XXX>(data)
(with a class mapping setup: ClassMapper.Add<XXX>("[dbo].[dbTableName]");
) and .BulkMerge("dbTableName", data)
, where data
is a DataTable that has been created from XXX.class objects.
Notably, I don't have any attribute mappings (I presume RepoDB can default map types like int, data, string, etc.).
(I suspect the problem is something fairly obvious on my end).
Exception Message:
Message:
System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
SqlConnectionExtension.BulkMergeInternalBase[TSqlBulkCopy,TSqlBulkCopyOptions,TSqlBulkCopyColumnMappingCollection,TSqlBulkCopyColumnMapping,TSqlTransaction](DbConnection connection, String tableName, DataTable dataTable, IEnumerable`1 qualifiers, Nullable`1 rowState, IEnumerable`1 mappings, TSqlBulkCopyOptions options, String hints, Nullable`1 bulkCopyTimeout, Nullable`1 batchSize, Nullable`1 isReturnIdentity, Nullable`1 usePhysicalPseudoTempTable, TSqlTransaction transaction)
SqlConnectionExtension.BulkMergeInternal(SqlConnection connection, String tableName, DataTable dataTable, IEnumerable`1 qualifiers, Nullable`1 rowState, IEnumerable`1 mappings, Nullable`1 options, String hints, Nullable`1 bulkCopyTimeout, Nullable`1 batchSize, Nullable`1 isReturnIdentity, Nullable`1 usePhysicalPseudoTempTable, SqlTransaction transaction)
SqlConnectionExtension.BulkMerge(SqlConnection connection, String tableName, DataTable dataTable, IEnumerable`1 qualifiers, Nullable`1 rowState, IEnumerable`1 mappings, Nullable`1 options, String hints, Nullable`1 bulkCopyTimeout, Nullable`1 batchSize, Nullable`1 isReturnIdentity, Nullable`1 usePhysicalPseudoTempTable, SqlTransaction transaction)
Schema and Model:
Model
public class XXX
{
public string? dealingCapacity { get; set; }
public string? exchange { get; set; }
public decimal? executedPrice { get; set; }
public decimal? executedQuantity { get; set; }
public DateTime? executedTimestampUtc { get; set; }
public int fillId { get; set; }
public string? lastLiquidity { get; set; }
public int placementId { get; set; }
public string? tranType { get; set; }
public int? version { get; set; }
}
Schema
The SQL schema is identical (names are identical). In terms of types, nvarchar(100)
equates to C# strings and the identical SQL types are used for C# decimal, int and DateTime.
Library Version:
RepoDb v1.12.9
RepoDb.SqlServer v1.1.4
RepoDb.SqlServer.BulkOperations v1.1.5