Page 1 of 1

PgSqlConnection.EnlistTransaction throws NotSupportedException

Posted: Wed 30 Aug 2017 18:29
by EvilShrike
System.NotSupportedException: Specified method is not supported.
at System.Data.Common.DbConnection.EnlistTransaction(Transaction transaction)

I'm using Devart.Data.PostgreSql 7.9.958 (trial).
As I can see PgSqlConnection.EnlistTransaction has no implementation any more, so the base method is used and it throws NotSupportedException

Why? It works before (in Express edition).

Re: PgSqlConnection.EnlistTransaction throws NotSupportedException

Posted: Thu 31 Aug 2017 09:54
by Shalex
Please specify:
1) are you using the Devart.* assemblies provided with installation (.NET Framework) or downloaded via NuGet (.NET Core)?
2) is your project type .NET Framework or .NET Core?

Re: PgSqlConnection.EnlistTransaction throws NotSupportedException

Posted: Thu 31 Aug 2017 14:41
by EvilShrike
Assembles were installed via nuget

A project targets both net462 and netcoreapp2.0, EnlistTransaction method fails on both.

the code:

Code: Select all

using System;
using Devart.Data;
namespace devart_sqlite
{
    class Program
    {
        static void Main(string[] args)
        {
            using(var con = new Devart.Data.PostgreSql.PgSqlConnection()) 
            {
            	con.ConnectionString = "...";
            	con.Open();
            	con.EnlistTransaction(System.Transactions.Transaction.Current);
            	Console.WriteLine("opened");
            }
        }
    }
}
Output:

Code: Select all

D:\Work\Learn\dotnet\devart_pgsql>dotnet run -f net462

Unhandled Exception: System.NotSupportedException: Specified method is not supported.
   at System.Data.Common.DbConnection.EnlistTransaction(Transaction transaction)
   at devart_sqlite.Program.Main(String[] args)

D:\Work\Learn\dotnet\devart_pgsql>dotnet run -f netcoreapp2.0

Unhandled Exception: System.NotSupportedException: Specified method is not supported.
   at System.Data.Common.DbConnection.EnlistTransaction(Transaction transaction)
   at devart_sqlite.Program.Main(String[] args) in D:\Work\Learn\dotnet\devart_pgsql\Program.cs:line 24

Re: PgSqlConnection.EnlistTransaction throws NotSupportedException

Posted: Wed 06 Sep 2017 17:37
by Shalex
.NET Standard 1.x (.NET Core 1.x) doesn't support TransactionScope:
https://github.com/dotnet/corefx/issues/2949
https://docs.microsoft.com/en-us/dotnet ... andard-1.3

Referencing .NET Framework assemblies from .NET Standard project will not solve the issue as well because this allows to only use types within the .NET Standard API set. Refer to https://blogs.msdn.microsoft.com/dotnet ... -core-2-0/ > the "Reference .NET Framework libraries from .NET Standard" section.

We will notify you when .NET Core 2.0 is supported by dotConnect for PostgreSQL.

Re: PgSqlConnection.EnlistTransaction throws NotSupportedException

Posted: Mon 30 Oct 2017 19:53
by Shalex
.NET Core 2.0 is supported: viewtopic.php?f=3&t=36126.