Open micaelle opened 3 months ago
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?