Closed ScruffyMagicM closed 3 months ago
Also happens with BulkInsert()
The actual exception is here in N.EntityFramework.Extensions.DbTransactionContext class
It seems this.Connection
is null
above that, where it gets the connection in N.EntityFramework.Extensions.DatabaseExtensions, It gets the connection, but when you do as SqlConnection
, it becomes null.
PS: noone mentioned it only works with SqlServer. I tried with mysql. What a waste of time. Edit: I see they did. But it should be bold and on top.
i have same problem here.
Same solution @NorthernLight1 ?
@NorthernLight1 , please check my sugestion
The PR for this bug has been approved and released in v1.9.0.
Describe the bug I'm trying to call BulkSaveChanges, but I'm receiving this error: Object reference not set to an instance of an object.
Additional information: I'm using entity framework 6.5.1 with Microsoft.Data.SqlClient as the provider. The same code worked without issue (6.4.4, System.Data.SqlClient) before I migrated to the newer entity framework version and provider, so I suspect it's relevant. The library describes says it supports 6.4.4+, which I took to mean 6.5.1 was included.
Stack Trace:
at N.EntityFramework.Extensions.DbTransactionContext..ctor(DbContext context, ConnectionBehavior connectionBehavior, TransactionalBehavior transactionalBehavior, Nullable`1 commandTimeout, Boolean openConnection)
Call Stack:
To Reproduce Steps to reproduce the behavior:
Call AddRange method. Call BulkSaveChanges method.
My code is explicitly this:
Expected behavior Correct handling of null values.
Desktop (please complete the following information):
OS: Windows Browser: Chrome Version: 126.0.6478.127 Sql Sever: Microsoft SQL Server Express (64-bit) v16.0.1000.6