You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a test code which calls some Bulk-method (BulkInsertOrUpdateAsync for instance). And when I launching this test in parallel for different db servers (MsSql and PostgreSql) it send queries to wrong targets - PostgreSql-queries to the MsSql server or, vice versa, MsSql-queries to Postgres.
This looks like issue #964, the error message is the same.
The root cause is database type have determined in static class (SqlAdaptersMapping.DbServer) and this works incorrect in parallel execution.
Async lock around of Bulk* calls was the solution for me. But seems this behavior may lead to complex bugs in multi-server configurations. Probably will valuable to mention that in readme, at least?
The text was updated successfully, but these errors were encountered:
micaelle
changed the title
BulkExtensions determine target DbContext incorrect when parallel calls to different database servers
BulkExtensions determines target DbContext incorrectly when calls to different database servers in parallel
May 16, 2024
I encounter the same situation. I have different tests running using different kinds of DB servers. The error I get is System.InvalidCastException : Unable to cast object of type 'Microsoft.Data.Sqlite.SqliteConnection' to type 'Microsoft.Data.SqlClient.SqlConnection'.
I have a test code which calls some Bulk-method (BulkInsertOrUpdateAsync for instance). And when I launching this test in parallel for different db servers (MsSql and PostgreSql) it send queries to wrong targets - PostgreSql-queries to the MsSql server or, vice versa, MsSql-queries to Postgres.
This looks like issue #964, the error message is the same.
The root cause is database type have determined in static class (SqlAdaptersMapping.DbServer) and this works incorrect in parallel execution.
Async lock around of Bulk* calls was the solution for me. But seems this behavior may lead to complex bugs in multi-server configurations. Probably will valuable to mention that in readme, at least?
The text was updated successfully, but these errors were encountered: