neisbut / Npgsql.Bulk

Helper for performing COPY (bulk insert and update) operation easily, using Entity Framework + Npgsql.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with efcore 6 missing method FindEntityType

martea opened this issue · comments

nice package but ran into some issues with dotnet6

narrowed it down to this part
https://github.com/neisbut/Npgsql.Bulk/blob/master/src/Npgsql.Bulk/NpgsqlHelper.cs#L144

IObjectContextAdapter think that is depricated in the latest version

Exception thrown: 'System.MissingMethodException' in System.Private.CoreLib.dll: 'Method not found: 'Microsoft.EntityFrameworkCore.Metadata.IEntityType Microsoft.EntityFrameworkCore.ModelExtensions.FindEntityType(Microsoft.EntityFrameworkCore.Metadata.IModel, System.Type)'.'
at Npgsql.Bulk.NpgsqlHelper.GetTableSchema(DbContext context, Type t)
at Npgsql.Bulk.NpgsqlBulkUploader.GetEntityInfoT
at Npgsql.Bulk.NpgsqlBulkUploader.d__40`1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task).

I'm having the same issue when moving to .NET 6. Still trying to find a work around to it.

Same issue. Has anyone found a way to make it work? Maybe we should work on a fork or a PR or something?

current source works, the nuget is outdated...

Yeah that makes sense. I ended up swapping to a different strategy using some alternative packages. The package I ended up using was PgPartner and using that to map the entity, then control the total entries inserted per cycle through a foreach loop.

https://www.nuget.org/packages/PgPartner/1.1.0

In case anyone needs an alternative and doesn't want to deal with building source code. For my own implementation the performance is close to identical.