-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
Unable to cast object of type 'Z.EntityFramework.Plus.CreateEntityConnection' to type 'Npgsql.NpgsqlConnection'. #708
Comments
Hello @tomerpeled , Thank you for reporting, we will try to reproduce it. Best Regards, Jon Sponsorship Performance Libraries Runtime Evaluation |
Hello @tomerpeled , Thank again for reporting. Unfortunately, it looks like that Unfortunately, we currently have no solution for this issue. We will try to eventually look again at it but for now, we will consider this feature do not longer supports this provider as this is impossible for us to fix it with the current time we have. |
Hi @JonathanMagnan, Thanks for the update! |
Hello, @tomerpeled ! Did you find the alternative to Future queries? I also need them to implement total in pagination use case. https://entityframework-plus.net/ef-core-query-future#paging |
Hi @pandarun, Unfortunately, there is no workaround for now... |
@JonathanMagnan do you think raising issue about this in Npgsql repo may help? |
Hello @alexb5dh , Unfortunately no, the error happens here if I remind correctly: https://github.com/npgsql/efcore.pg/blob/cf4f23ecc271b3c9753600ec84a65c7d4053991d/src/EFCore.PG/Storage/Internal/NpgsqlRelationalConnection.cs#L81 It cast our custom connection into a |
Hi, I have the same issue with .net6 upgrade. Are you working on this problem? Will we be able to upgrade to net6 sometime? Thx, |
Hello @Balogh-Andras , Unfortunately, we don't have enough time at this moment to work on this problem. Supporting EF Core 7 and re-writing our core code to support new features they bring is currently our priority. We hope to eventually fix it, but like everyone's problem, time is missing, so we currently prioritize development. This one is not easy to fix and ask us to rewrite most of it to support PostgreSQL and Oracle. |
Maybe a way to fix this is to have a cast operator for the original connection type ? I'm really new to efcore plus as I've just downloaded it a few minutes ago. |
After updating my project to .NET 7, EF7, Npgsql 7, and EntityFramework-Plus' last version, I don't get this Exception anymore and it seems to be working correctly. Give a try! |
After upgrading to .NET Core 6 (with EFCore 6 update + EntityFramework-plus), I'm now getting the following exception when using the Plus lib:
System.InvalidCastException: Unable to cast object of type 'Z.EntityFramework.Plus.CreateEntityConnection' to type 'Npgsql.NpgsqlConnection'.
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlRelationalConnection.get_DbConnection()
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlRelationalConnection.get_CurrentAmbientTransaction()
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.HandleAmbientTransactions()
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable
1.Enumerator.InitializeReader(Enumerator enumerator) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable
1.Enumerator.<>c.b__19_0(DbContext _, Enumerator enumerator)at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.Execute[TState,TResult](TState state, Func
3 operation, Func
3 verifySucceeded)at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable
1.Enumerator.MoveNext() at Z.EntityFramework.Plus.QueryFutureValue
1.SetResult(DbDataReader reader)at Z.EntityFramework.Plus.QueryFutureBatch.ExecuteQueriesAsync(CancellationToken cancellationToken)
at Z.EntityFramework.Plus.QueryFutureValue`1.ValueAsync(CancellationToken cancellationToken)
Any idea how can we solve it?
Thanks,
Tomer
The text was updated successfully, but these errors were encountered: