MRCollective / ReliableDbProvider

Provides a Db Provider Factory that uses the Microsoft Transient Fault Handling library to allow for reliable SQL Azure connections when using Entity Framework 4, Entity Framework 5 or Linq 2 SQL.
MIT License
20 stars 4 forks source link

Using inside a TransactionScope throws "Specified method is not supported" #16

Open lawrenceshort opened 8 years ago

lawrenceshort commented 8 years ago

When using a DataContext inside a TransactionScope a "Specified Method is not supported" exception is thrown at the System.Data.Common.DbConnection.EnlistTransaction stage.

lawrenceshort commented 8 years ago

This can be fixed by including the System.Transactions reference and overriding the EnlistTransaction method in ReliableSqlDbConnection as below

    public override void EnlistTransaction(Transaction transaction)
    {
        ReliableConnection.Current.EnlistTransaction(transaction);
    }

Transactions inside a TransactionScope then function perfectly.

robdmoore commented 8 years ago

Nice! Do you mind submitting a pull request along with a test?

On 24 Feb 2016, at 1:17 am, lawrenceshort notifications@github.com wrote:

This can be fixed by including the System.Transactions reference and overriding the EnlistTransaction method in ReliableSqlDbConnection as below

public override void EnlistTransaction(Transaction transaction)
{
    ReliableConnection.Current.EnlistTransaction(transaction);
}

Transactions inside a TransactionScope then function perfectly.

— Reply to this email directly or view it on GitHub.

psheldon commented 7 years ago

Is it possible to get the NuGet package update with this fix? I've installed the package that has the transient fault handling library ILMerged into it, and I'm getting this same exception as above.

robdmoore commented 7 years ago

More than happy for anyone to submit a PR

psheldon commented 7 years ago

Hi Rob

Not sure this is about a PR, but rather than a PR was created back in 2016 but the Nuget package doesn't reflect that change.

Cheers Paul (also in Perth!)


From: Rob Moore [notifications@github.com] Sent: Tuesday, 5 September 2017 11:27 AM To: MRCollective/ReliableDbProvider Cc: Paul Sheldon; Comment Subject: Re: [MRCollective/ReliableDbProvider] Using inside a TransactionScope throws "Specified method is not supported" (#16)

More than happy for anyone to submit a PR

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/MRCollective/ReliableDbProvider/issues/16#issuecomment-327062212, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEHciRM-pgBcUfIYEp1hhNi9ScnS8UErks5sfL-YgaJpZM4Hgfg1.

robdmoore commented 7 years ago

AH, so it was - sorry.

Looks like tests are failing on that. Not sure if it's the build server or the code itself.