neisbut / Npgsql.Bulk

Helper for performing COPY (bulk insert and update) operation easily, using Entity Framework + Npgsql.
MIT License
106 stars 44 forks source link

Issue with efcore 6 missing method FindEntityType #70

Open martea opened 2 years ago

martea commented 2 years ago

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.GetEntityInfo[T]() 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).

Colt2205 commented 2 years ago

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

msigle commented 2 years ago

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

adisadi commented 2 years ago

current source works, the nuget is outdated...

Colt2205 commented 2 years ago

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.