Open Closed

Error The specified transaction is not associated with the current connection 4.2.1 with devart oracle connection #955


User avatar
0
bhyatz created

Hi

My devart oracle connection is not working after updating to 4.2.1. We were actually migrating from version 3.0.4 so the error could have been introduced earlier. We are getting "The specified transaction is not associated with the current connection." error in the background.

I am able to reproduce the problem using the steps below with a new solution.

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

  • ABP Framework version: v4.2.1
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:
  1. Create a new solution: abp new NexBase --ui angular
  2. Add Package refrence <PackageReference Include="Volo.Abp.EntityFrameworkCore.Oracle.Devart" Version="4.2.1" /> to NexBase.EntityFrameworkCore.csproj
  3. In NexBaseEntityFrameworkCoreModule change options.UseSqlServer(); to options.UseOracle(); and add typeof(AbpEntityFrameworkCoreOracleDevartModule) to the depends
  4. Modify NexBaseMigrationsDbContextFactory from new DbContextOptionsBuilder<NexBaseMigrationsDbContext>() .UseSqlServer(configuration.GetConnectionString("Default"));

new DbContextOptionsBuilder<NexBaseMigrationsDbContext>() .UseOracle(configuration.GetConnectionString("Default"));

  1. Add Migrations src\NexBase.EntityFrameworkCore.DbMigrations>dotnet ef -s ..\NexBase.DbMigrator migrations add Initial Build started... Build succeeded. Done. To undo this action, use 'ef migrations remove'

  2. Run migrations src\NexBase.EntityFrameworkCore.DbMigrations>dotnet ef -s ..\NexBase.DbMigrator database update Build started... Build succeeded. Applying migration '20210224162217_Initial'.

  3. Seed Data. Run dbMigrator project

[18:38:19 INF] Started database migrations... [18:38:19 INF] Migrating schema for host database... [18:38:21 INF] Executing host database seed... Unhandled exception. System.InvalidOperationException: The specified transaction is not associated with the current connection. Only transactions associated with the current connection may be used. at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction..ctor(IRelationalConnection connection, DbTransaction transaction, Guid transactionId, IDiagnosticsLogger1 logger, Boolean transactionOwned) at Microsoft.EntityFrameworkCore.Storage.RelationalTransactionFactory.Create(IRelationalConnection connection, DbTransaction transaction, Guid transactionId, IDiagnosticsLogger1 logger, Boolean transactionOwned) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.CreateRelationalTransaction(DbTransaction transaction, Guid transactionId, Boolean transactionOwned) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.UseTransactionAsync(DbTransaction transaction, Guid transactionId, CancellationToken cancellationToken) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextWithTransactionAsync(IUnitOfWork unitOfWork) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextAsync(IUnitOfWork unitOfWork) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextAsync(IUnitOfWork unitOfWork, String connectionStringName, String connectionString) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.GetDbContextAsync() at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository2.GetDbSetAsync() at Volo.Abp.Identity.EntityFrameworkCore.EfCoreIdentityUserRepository.FindByNormalizedUserNameAsync(String normalizedUserName, Boolean includeDetails, CancellationToken cancellationToken) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.Identity.IdentityDataSeeder.SeedAsync(String adminEmail, String adminPassword, Nullable1 tenantId) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.Data.DataSeeder.SeedAsync(DataSeedContext context) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at NexBase.Data.NexBaseDbMigrationService.SeedDataAsync(Tenant tenant) in C:\tmp\abp\Nexbase\aspnet-core\src\NexBase.Domain\Data\NexBaseDbMigrationService.cs:line 107 at NexBase.Data.NexBaseDbMigrationService.MigrateAsync() in C:\tmp\abp\Nexbase\aspnet-core\src\NexBase.Domain\Data\NexBaseDbMigrationService.cs:line 57 at NexBase.DbMigrator.DbMigratorHostedService.StartAsync(CancellationToken cancellationToken) in C:\tmp\abp\Nexbase\aspnet-core\src\NexBase.DbMigrator\DbMigratorHostedService.cs:line 30 at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at NexBase.DbMigrator.Program.Main(String[] args) in C:\tmp\abp\Nexbase\aspnet-core\src\NexBase.DbMigrator\Program.cs:line 29 at NexBase.DbMigrator.Program.<Main>(String[] args)

  1. Surround all seed data by using (_unitOfWorkManager.Begin(requiresNew: true)) { await SeedDataAsync(); }
  2. Rerun Seed
  3. Start webapi. host project
  4. Try to run /api​/account​/login from swagger [18:47:28 INF] No CORS policy found for the specified request. [18:47:28 INF] Executing endpoint 'Volo.Abp.Account.Public.Web.Areas.Account.Controllers.AccountController.Login (Volo.Abp.Account.Pro.Public.Web)' [18:47:28 INF] Route matched with {area = "account", controller = "Login", action = "Login", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.Account.Public.Web.Areas.Account.Controllers.Models.AbpLoginResult] Login( Volo.Abp.Account.Public.Web.Areas.Account.Controllers.Models.UserLoginInfo) on controller Volo.Abp.Account.Public.Web.Areas.Account.Controllers.AccountController (Volo.Abp.Account.Pro.Public.Web). [18:47:28 DBG] Login Url: /Account/Login [18:47:28 DBG] Login Return Url Parameter: ReturnUrl [18:47:28 DBG] Logout Url: /Account/Logout [18:47:28 DBG] ConsentUrl Url: /Consent [18:47:28 DBG] Consent Return Url Parameter: returnUrl [18:47:28 DBG] Error Url: /Account/Error [18:47:28 DBG] Error Id Parameter: errorId [18:47:30 ERR] ---------- RemoteServiceErrorInfo ---------- { "code": null, "message": "An internal error occurred during your request!", "details": null, "data": {}, "validationErrors": null }

[18:47:30 ERR] The specified transaction is not associated with the current connection. Only transactions associated with the current connection may be used. System.InvalidOperationException: The specified transaction is not associated with the current connection. Only transactions associated with the current connection may be used. at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction..ctor(IRelationalConnection connection, DbTransaction transaction, Guid transactionId, IDiagnosticsLogger1 logger, Boolean transactionOwned) at Microsoft.EntityFrameworkCore.Storage.RelationalTransactionFactory.Create(IRelationalConnection connection, DbTransaction transaction, Guid transactionId, IDiagnosticsLogger1 logger, Boolean transactionOwned) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.CreateRelationalTransaction(DbTransaction transaction, Guid transactionId, Boolean transactionOwned) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.UseTransactionAsync(DbTransaction transaction, Guid transactionId, CancellationToken cancellationToken) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextWithTransactionAsync(IUnitOfWork unitOfWork) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextAsync(IUnitOfWork unitOfWork) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextAsync(IUnitOfWork unitOfWork, String connectionStringName, String connectionString) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.GetDbContextAsync() at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository2.GetDbSetAsync() at Volo.Abp.FeatureManagement.EntityFrameworkCore.EfCoreFeatureValueRepository.GetListAsync(String providerName, String providerKey) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.FeatureManagement.FeatureManagementStore.SetCacheItemsAsync(String providerName, String providerKey, String currentName, FeatureValueCacheItem currentCacheItem) at Volo.Abp.FeatureManagement.FeatureManagementStore.GetCacheItemAsync(String name, String providerName, String providerKey) at Volo.Abp.FeatureManagement.FeatureManagementStore.GetOrNullAsync(String name, String providerName, String providerKey) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.Features.TenantFeatureValueProvider.GetOrNullAsync(FeatureDefinition feature) at Volo.Abp.Features.FeatureChecker.GetOrNullValueFromProvidersAsync(IEnumerable1 providers, FeatureDefinition feature) at Volo.Abp.Features.FeatureChecker.GetOrNullAsync(String name) at Volo.Abp.Features.FeatureCheckerBase.IsEnabledAsync(String name) at Volo.Abp.Account.Public.Web.Ldap.LdapExternalLoginProvider.TryAuthenticateAsync(String userName, String plainPassword) at Volo.Abp.Identity.AspNetCore.AbpSignInManager.PasswordSignInAsync(String userName, String password, Boolean isPersistent, Boolean lockoutOnFailure) at Volo.Abp.Account.Public.Web.Areas.Account.Controllers.AccountController.Login(UserLoginInfo login) at lambda_method1837(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.


23 Answer(s)
  • User Avatar
    0
    alper created
    Support Team Director

    Sorry but my devart trial license has been expired. I need to find a license to check this issue.

  • User Avatar
    0
    alper created
    Support Team Director

    Meanwhile can you try this workaround Open MyProjectEntityFrameworkCoreModule.cs in ConfigureServices method. Delete options.UseSqlServer and write the below:

    Configure<AbpDbContextOptions>(options =>
    {
       options.Configure(ctx =>
       {
           ctx.DbContextOptions.UseOracle(ctx.ConnectionString);
       });
    });
    

  • User Avatar
    0
    bhyatz created

    I tried the work around. I changed the original code to the new code however I am still getting the same error. Original:

    public override void ConfigureServices(ServiceConfigurationContext context)
            {
                context.Services.AddAbpDbContext<NexBaseDbContext>(options =>
                {
                    /* Remove "includeAllEntities: true" to create
                     * default repositories only for aggregate roots */
                    options.AddDefaultRepositories(includeAllEntities: true);
                });
    
                Configure<AbpDbContextOptions>(options =>
                {
                    /* The main point to change your DBMS.
                     * See also NexBaseMigrationsDbContextFactory for EF Core tooling. */
                    options.UseOracle();
                });
            }
    
    

    New:

    public override void ConfigureServices(ServiceConfigurationContext context)
            {
                context.Services.AddAbpDbContext<NexBaseDbContext>(options =>
                {
                    /* Remove "includeAllEntities: true" to create
                     * default repositories only for aggregate roots */
                    options.AddDefaultRepositories(includeAllEntities: true);
                });
    
                Configure<AbpDbContextOptions>(options =>
                {
                    /* The main point to change your DBMS.
                     * See also NexBaseMigrationsDbContextFactory for EF Core tooling. */
                    //options.UseOracle();
                    options.Configure(ctx => { ctx.DbContextOptions.UseOracle(ctx.ConnectionString); });
                });
            }
    
           ading.Tasks.Task`1[Volo.Abp.Account.Public.Web.Areas.Account.Controllers.Models.AbpLoginResult] Login(Volo.Abp.Account.Public.Web.Areas.Account.Controllers.Mod
    els.UserLoginInfo) on controller Volo.Abp.Account.Public.Web.Areas.Account.Controllers.AccountController (Volo.Abp.Account.Pro.Public.Web).
    [06:57:50 DBG] Login Url: /Account/Login
    [06:57:50 DBG] Login Return Url Parameter: ReturnUrl
    [06:57:50 DBG] Logout Url: /Account/Logout
    [06:57:50 DBG] ConsentUrl Url: /Consent
    [06:57:50 DBG] Consent Return Url Parameter: returnUrl
    [06:57:50 DBG] Error Url: /Account/Error
    [06:57:50 DBG] Error Id Parameter: errorId
    [06:57:51 ERR] ---------- RemoteServiceErrorInfo ----------
    {
      "code": null,
      "message": "An internal error occurred during your request!",
      "details": null,
      "data": {},
      "validationErrors": null
    }
    
    [06:57:51 ERR] The specified transaction is not associated with the current connection. Only transactions associated with the current connection may be used.
    System.InvalidOperationException: The specified transaction is not associated with the current connection. Only transactions associated with the current connec
    tion may be used.
       at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction..ctor(IRelationalConnection connection, DbTransaction transaction, Guid transactionId, IDiagn
    osticsLogger`1 logger, Boolean transactionOwned)
       at Microsoft.EntityFrameworkCore.Storage.RelationalTransactionFactory.Create(IRelationalConnection connection, DbTransaction transaction, Guid transactionId
    , IDiagnosticsLogger`1 logger, Boolean transactionOwned)
       at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.CreateRelationalTransaction(DbTransaction transaction, Guid transactionId, Boolean transaction
    Owned)
       at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.UseTransactionAsync(DbTransaction transaction, Guid transactionId, CancellationToken cancellat
    ionToken)
       at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider`1.CreateDbContextWithTransactionAsync(IUnitOfWork unitOfWork)
       at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider`1.CreateDbContextAsync(IUnitOfWork unitOfWork)
       at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider`1.CreateDbContextAsync(IUnitOfWork unitOfWork, String connectionStringName, String connectio
    nString)
       at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider`1.GetDbContextAsync()
       at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository`2.GetDbSetAsync()
       at Volo.Abp.FeatureManagement.EntityFrameworkCore.EfCoreFeatureValueRepository.GetListAsync(String providerName, String providerKey)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`
    3 proceed)
       at Volo.Abp.FeatureManagement.FeatureManagementStore.SetCacheItemsAsync(String providerName, String providerKey, String currentName, FeatureValueCacheItem c
    urrentCacheItem)
       at Volo.Abp.FeatureManagement.FeatureManagementStore.GetCacheItemAsync(String name, String providerName, String providerKey)
       at Volo.Abp.FeatureManagement.FeatureManagementStore.GetOrNullAsync(String name, String providerName, String providerKey)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`
    3 proceed)
       at Volo.Abp.Features.TenantFeatureValueProvider.GetOrNullAsync(FeatureDefinition feature)
       at Volo.Abp.Features.FeatureChecker.GetOrNullValueFromProvidersAsync(IEnumerable`1 providers, FeatureDefinition feature)
       at Volo.Abp.Features.FeatureChecker.GetOrNullAsync(String name)
       at Volo.Abp.Features.FeatureCheckerBase.IsEnabledAsync(String name)
       at Volo.Abp.Account.Public.Web.Ldap.LdapExternalLoginProvider.TryAuthenticateAsync(String userName, String plainPassword)
       at Volo.Abp.Identity.AspNetCore.AbpSignInManager.PasswordSignInAsync(String userName, String password, Boolean isPersistent, Boolean lockoutOnFailure)
       at Volo.Abp.Account.Public.Web.Areas.Account.Controllers.AccountController.Login(UserLoginInfo login)
       at lambda_method1998(Closure , Object )
       at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor e
    xecutor, Object controller, Object[] arguments)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeActionMethodAsync&gt;g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 ac   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor
    executor, Object controller, Object[] arguments)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 ac
    tionResultValueTask)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeNextActionFilterAsync&gt;g__Awaited|10_0(ControllerActionInvoker invoker, Task lastT
    ask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
    --- End of stack trace from previous location ---
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextExceptionFilterAsync&gt;g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State ne
    xt, Scope scope, Object state, Boolean isCompleted)
    
    
  • User Avatar
    0
    alper created
    Support Team Director

    @bhyatz can you create a new solution and test this issue on the new solution (v4.2.1) so we'll understand if you miss a migration step while upgrading from v3x to v4x

  • User Avatar
    0
    bhyatz created

    @alper. Thanks. I am getting the problem with a new solution in v4.2.1. My upgraded solution, I am getting the error on many other webapi services.

    Debugging it, I get the error in this code in Microsoft.EntityFrameworkCore.Storage The connection.DbConnection and the transaction.Connection are not the same object.

    <br>

    when debugging there is only one connection defined, so it looks like somewhere in the transaction a new connection is opened

    connection.DbConnection

    transaction.Connection

    <br> <br>

  • User Avatar
    0
    toan.nguyen created

    I am having the same problem with Oracle version 19c.xx. I created new solution from beginning using ABP Suite, no migration so I think the issue happens in framework.

  • User Avatar
    0
    alper created
    Support Team Director

    @toan.nguyen are you also using Devart Oracle provider or the official Oracle provider?

  • User Avatar
    0
    toan.nguyen created

    @toan.nguyen are you also using Devart Oracle provider or the official Oracle provider?

    I am using the Devart Oracle provider. The official Oracle provider haven't been integrated in the 4.2.1 yet, I'm waiting for the new version as you guys said it will be released in version 4.3.

  • User Avatar
    0
    toan.nguyen created

    @toan.nguyen are you also using Devart Oracle provider or the official Oracle provider?

    @bhyatz I am using Devart.

  • User Avatar
    0
    bhyatz created

    @alper

    Are you still looking at this issue?

  • User Avatar
    0
    alper created
    Support Team Director

    yes we just recieved our Devart license.

  • User Avatar
    0
    alper created
    Support Team Director

    using ABP v4.2.1

    switched to Devart Oracle package changed dbcontext to use oracle deleted migrations folder added migrations and updated database tested an endpoint

    followed this doc https://docs.abp.io/en/abp/latest/Entity-Framework-Core-Oracle-Devart and couldn't reproduce it.

    PS: I installed Devart Oracle 9.14.1204

  • User Avatar
    0
    bhyatz created

    @alper. The database creation does not break. You need to run the Dbmigrator project. The code breaks in the data seeding. I followed your steps again. but when I run the DbMigrator project I get the error.

    C:\tmp\abp\aspnet-core\src\NexBase.EntityFrameworkCore.DbMigrations>dotnet ef -s ..\NexBase.DbMigrator database update Build started... Build succeeded. The Entity Framework tools version '5.0.3' is older than that of the runtime '5.0.4'. Update the tools for the latest features and bug fixes. Applying migration '20210310150827_Initial'. Done.

    C:\tmp\abp\aspnet-core\src\NexBase.EntityFrameworkCore.DbMigrations>cd ..

    C:\tmp\abp\aspnet-core\src>cd NexBase.DbMigrator

    C:\tmp\abp\aspnet-core\src\NexBase.DbMigrator>dotnet run [17:15:03 INF] Started database migrations... [17:15:03 INF] Migrating schema for host database... [17:15:04 INF] Executing host database seed... Unhandled exception. System.InvalidOperationException: The specified transaction is not associated with the current connection. Only transactions associated with the current connection may be used. at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction..ctor(IRelationalConnection connection, DbTransaction transaction, Guid transactionId, IDiagnosticsLogger1 logger, Boolean transactionOwned) at Microsoft.EntityFrameworkCore.Storage.RelationalTransactionFactory.Create(IRelationalConnection connection, DbTransaction transaction, Guid transactionId, IDiagnosticsLogger1 logger, Boolean transactionOwned) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.CreateRelationalTransaction(DbTransaction transaction, Guid transactionId, Boolean transactionOwned) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.UseTransactionAsync(DbTransaction transaction, Guid transactionId, CancellationToken cancellationToken) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextWithTransactionAsync(IUnitOfWork unitOfWork) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextAsync(IUnitOfWork unitOfWork) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextAsync(IUnitOfWork unitOfWork, String connectionStringName, String connectionString) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.GetDbContextAsync() at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository2.GetDbSetAsync() at Volo.Abp.Identity.EntityFrameworkCore.EfCoreIdentityUserRepository.FindByNormalizedUserNameAsync(String normalizedUserName, Boolean includeDetails, CancellationToken cancellationToken) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.Identity.IdentityDataSeeder.SeedAsync(String adminEmail, String adminPassword, Nullable1 tenantId) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.Data.DataSeeder.SeedAsync(DataSeedContext context) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at NexBase.Data.NexBaseDbMigrationService.SeedDataAsync(Tenant tenant) in C:\tmp\abp\aspnet-core\src\NexBase.Domain\Data\NexBaseDbMigrationService.cs:line 107 at NexBase.Data.NexBaseDbMigrationService.MigrateAsync() in C:\tmp\abp\aspnet-core\src\NexBase.Domain\Data\NexBaseDbMigrationService.cs:line 57 at NexBase.DbMigrator.DbMigratorHostedService.StartAsync(CancellationToken cancellationToken) in C:\tmp\abp\aspnet-core\src\NexBase.DbMigrator\DbMigratorHostedService.cs:line 30 at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at NexBase.DbMigrator.Program.Main(String[] args) in C:\tmp\abp\aspnet-core\src\NexBase.DbMigrator\Program.cs:line 29 at NexBase.DbMigrator.Program.<Main>(String[] args)

  • User Avatar
    0
    alper created
    Support Team Director

    finally reproduced it :)

  • User Avatar
    0
    alper created
    Support Team Director

    we are still investigating the issue.

  • User Avatar
    0
    bhyatz created

    @alper . Is there an estimated time when this issue will be resolved as it is preventing us from updating to version 4. We are still on version 3.0.4.

  • User Avatar
    0
    alper created
    Support Team Director

    I've tested this on official Oracle provider and it works. I guess there's a problem with Devart's library. can you check this with the latest Oracle provider.

  • User Avatar
    0
    bhyatz created

    @alper. We have all our code already deployed to production with the devart driver and the migrations for the versions have all been done with devart. Changing to the oracle provider may break our deployed code.

    We also have a large amount of data in our production database, and it will not be easy to change our migrations from devart to oracle if the oracle migrations are not compatible with devart. We have 243 entities and large volume of data already in the entities.

  • User Avatar
    0
    alper created
    Support Team Director

    It's still active on my side. And planning to investigate the issue deeper with our Oracle package author.

  • User Avatar
    0
    alper created
    Support Team Director

    We have fixed the The specified transaction is not associated with the current connection exception. See the related commit => https://github.com/abpframework/abp/issues/8049 it'll be ready next version.


    On the other hand, we have found another issue. In this issue INSERT/UPDATE transactions throws Sequence contains no elements error. This bug is fixed by Devart Team. See the following links:

    • https://stackoverflow.com/questions/65304010/cannot-savechanges-in-net-5-ef-core-with-devart-data-oracle-efcore
    • https://forums.devart.com/viewtopic.php?f=1&t=44320
  • User Avatar
    0
    alper created
    Support Team Director

    Took my 2 days. Finally we run it:

    https://github.com/abpframework/abp/commit/bea4d410fcab5ab01492348907c90dd1b0afe73b

    Wait for the next version (ETA 7 days)

  • User Avatar
    0
    hikalkan created
    Support Team Co-Founder

    no need to wait. you can just upgrade to latest devart package in your own application.

  • User Avatar
    0
    alper created
    Support Team Director

    closing the issue. you can always reopen it.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09