PgSqlConnection.EnlistTransaction throws NotSupportedException

PgSqlConnection.EnlistTransaction throws NotSupportedException

Postby EvilShrike » Wed 30 Aug 2017 18:29

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).
EvilShrike
 
Posts: 15
Joined: Mon 14 Mar 2016 17:11

Re: PgSqlConnection.EnlistTransaction throws NotSupportedException

Postby Shalex » Thu 31 Aug 2017 09:54

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?
Shalex
Devart Team
 
Posts: 7774
Joined: Thu 14 Aug 2008 12:44

Re: PgSqlConnection.EnlistTransaction throws NotSupportedException

Postby EvilShrike » Thu 31 Aug 2017 14:41

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
EvilShrike
 
Posts: 15
Joined: Mon 14 Mar 2016 17:11

Re: PgSqlConnection.EnlistTransaction throws NotSupportedException

Postby Shalex » Wed 06 Sep 2017 17:37

.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/api/system.transactions.transactionscope?view=netframework-4.7&viewFallbackFrom=netstandard-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/2017/08/14/announcing-net-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.
Shalex
Devart Team
 
Posts: 7774
Joined: Thu 14 Aug 2008 12:44

Re: PgSqlConnection.EnlistTransaction throws NotSupportedException

Postby Shalex » Mon 30 Oct 2017 19:53

Shalex
Devart Team
 
Posts: 7774
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for PostgreSQL