UseOracle throws Unexpected connection type 'Devart.Data.Oracle.Entity.ao'
Posted: Tue 17 Nov 2020 10:54
We are trying to reuse an existing connection inside of a new scope, in order for the transaction in the parent scope to work. We tried updating to the latest version 9.13.1127. We have the same code working correctly with mssql and postgresql.
The code we have is somewhat equivalent to the following:
* It is the first time UseOracle is executed in the child scope.
We get the following exception:
I think this may be the same issue as what we've encountered.
https://github.com/abpframework/abp/issues/4473
The code we have is somewhat equivalent to the following:
Code: Select all
...
using var scope = _serviceProvider.CreateScope();
var dbConnection = parentScopeDbContext.Database.CurrentTransaction.GetDbTransaction().Connection;
var dbContextOptionBuilder = scope.ServiceProvider.GetRequiredService<DbContextOptionsBuilder>();
dbContextOptionBuilder.UseOracle(dbConnection, ...);
We get the following exception:
Code: Select all
---> System.InvalidOperationException: Unexpected connection type 'Devart.Data.Oracle.Entity.ao'.
at Microsoft.EntityFrameworkCore.OracleDbContextOptionsBuilderExtensions.a(DbConnection A_0)
at Microsoft.EntityFrameworkCore.OracleDbContextOptionsBuilderExtensions.UseOracle(DbContextOptionsBuilder options, DbConnection connection, Action`1 optionAction)
https://github.com/abpframework/abp/issues/4473