Skip to content

"The specified transaction is not associated with the current connection" #9829

@ComptonAlvaro

Description

@ComptonAlvaro

I am trying to use the same transaction between many dataContext. I am trying the same code that I am found in the documentation here "The specified transaction is not associated with the current connection"

My code is this:

using (Entities midbContext = new Entities(_optionsDbContext))
{
	using (IDbContextTransaction miTransaccion = await midbContext.Database.BeginTransactionAsync())
	{
		using (Entities midbContext01 = new Entities(_optionsDbContext))
		{
			midbContext01.Database.UseTransaction(miTransaccion.GetDbTransaction());
		}
	}
}

Then problem is in the last line, in the method UseTransaction, it throws an exception that says that "The specified transaction is not associated with the current connection".

I would like to use the same transaction in many dbContext.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions