Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EntityFramework6.Npgsql update to use Npgsql 4.1? #137

Closed
warcha opened this issue Sep 27, 2019 · 9 comments
Closed

EntityFramework6.Npgsql update to use Npgsql 4.1? #137

warcha opened this issue Sep 27, 2019 · 9 comments

Comments

@warcha
Copy link

warcha commented Sep 27, 2019

Hi I tried updating the latest release of EF6.Npgsql (3.2.1) to use Npgsql (4.1) by changing the TargetFramework to net461 and changing the reference to Npgsql (4.0.7) to point to Npgsql (4.1) however when running the test suite I get the following error:

System.InvalidOperationException: This NpgsqlTransaction has completed; it is no longer usable.

which looks to be directly related to: npgsql/npgsql#985. The last comment on there was that the IsCompleted flag was being removed for Npgsql 4.1.

Does this mean that the EF6.Npgsql (3.2.1) project needs to be updated to use Npgsql 4.1 and if so what kind of time frame could this be expected to be completed in?

@ntuchenxy
Copy link

same problem, now i put all database related codes in a TransactionScope as a temporary solution.

@alexh-swdev
Copy link

alexh-swdev commented Oct 1, 2019

Same here. I started on Friday with an EF6/Postgres Project. I am always getting this execption during Migration, during Save(), ... (At first, I ignored it, because, e.g. Save() got executed in the "real" database, but today I realized I can't even run the Migrations properly)

This code already fails at SaveChanges (but the changes appear in the database) :

            using (var ctxt = new PostgreSQLDbContext())
            {
                ctxt.Users.Add(new WpUser { Id = 1, Name = "Test", Password = "Pwd" });
                ctxt.SaveChanges();
                Console.WriteLine(ctxt.Users.ToArray().Length);
            }

@warcha which configration was your last working one? (Which versions did you use?)

My current packages:
EntityFramework 6.3.0
EntityFramework6.Npgsql 6.3.0-preview5 (did not work with last stable 3.2.1.1 either)
Npgsql 4.1.0 (I think, 4.0.7 was initially installed, with EF6.Npgsql 3.2.1.1 - not working)

/Edit: For now, per "trial and error" on a minimal project, this package config seems to work:
EF 6.3.0 (current last stable)
EF6.Npgsql 3.2.1.1 (current last stable)
Npgsql 4.0.10 (Here, the last stable 4.1.0 breaks everything)

@busyscout
Copy link

Same problem. 4.0.10 works, 4.1 gives an error.

@roji
Copy link
Member

roji commented Oct 1, 2019

Thanks to everyone for the testing the new version!

First, Npgsql 4.1.0 contained a few unintended breaking changes. 4.1.1 will be released very soon (i.e. a couple days) and should fix these.

Second, I also need to publish version 6.3.0 of the EF6 provider - this will probably have to wait a few extra days but it will happen soon as well. That would be the right version to test rather than preview5.

@arif-hanif
Copy link

I am looking forward to EF 6.3, currently have had to use join tables for many to many fields in EF Core any timeline on this?

@roji roji closed this as completed in d302371 Oct 10, 2019
@roji
Copy link
Member

roji commented Oct 10, 2019

Just published 6.3.0 to nuget.org! Please try it out and let me know how it works!

@roji
Copy link
Member

roji commented Oct 10, 2019

Note that the new version uses 4.0.10 by default, in order to preserve compatibility with .NET Framework 4.5. However, you can take a dependency on Npgsql 4.1 instead.

@rtibbett
Copy link

I was also getting the same error ' This NpgsqlTransaction has completed; it is no longer usable' using .net 4.7.1, EF 6.3.0, EF6.Npgsql 6.3.0 and Npgsql 4.1.0. Good news Npgsql 4.1.1 fixed the problem for me. Wasted so much time on this!

@roji
Copy link
Member

roji commented Oct 14, 2019

Good to hear this is working again and sorry for the trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants