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

Z.EntityFramework.Extensions.EFCore v9.103.6.4 doesn't support inMemory BulkInsert #616

Open
dean-kaila opened this issue Jan 3, 2025 · 1 comment
Assignees

Comments

@dean-kaila
Copy link

dean-kaila commented Jan 3, 2025

Description

After upgrading to the following

  • dotnet9
  • Microsoft.EntityFrameworkCore.InMemory:9.0.0
  • Z.EntityFramework.Extensions.EFCore:9.103.6.4

BulkInsert doesn't work with the inmemory provider. This used to work on the following.

  • dotnet8
  • Microsoft.EntityFrameworkCore.InMemory:8.0.10
  • Z.EntityFramework.Extensions.EFCore:8.103.6

One of my unit tests is calling a service which uses bulkInsert and now is failing with the exception below.
To replicate, I just followed this example (https://entityframework-extensions.net/efcore-inmemory-provider) using the latest packages as listed above but using the BulkInsert instead.
If this isn't supported anymore, please advise on how to resolve.

Exception

System.InvalidOperationException: The model must be finalized and its runtime dependencies must be initialized before 'GetRelationalModel' can be used. Ensure that either 'OnModelCreating' has completed or, if using a stand-alone 'ModelBuilder', that 'IModelRuntimeInitializer.Initialize(model.FinalizeModel())' was called.
   at Microsoft.EntityFrameworkCore.RelationalModelExtensions.GetRelationalModel(IModel model)
   at Microsoft.EntityFrameworkCore.Internal.RelationalModelExtensions.EnsureRelationalModel(IModel model)
   at Microsoft.EntityFrameworkCore.RelationalTypeBaseExtensions.GetTableMappings(ITypeBase typeBase)
   at Z.EntityFramework.Extensions.EntityTypeZInfo.CleanupEntityConstructor()
   at Z.EntityFramework.Extensions.EntityTypeZInfo..ctor(IEntityType entityType)
   at PublicExtensions..(IEntityType )
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at PublicExtensions.ToZInfo(IEntityType entityType)
   at .BulkInsert[T](DbContext this, IEnumerable`1 entities, Action`1 options, Boolean isBulkSaveChanges, Boolean isOptimized)

Fiddle or Project (Optional)

https://dotnetfiddle.net/NCoIGU

@JonathanMagnan JonathanMagnan self-assigned this Jan 3, 2025
@JonathanMagnan
Copy link
Member

Hello @dean-kaila ,

Thank you for reporting, indeed there is some scenario we do not support yet for InMemory.

We are currently looking into it.

Best Regards,

Jon

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

No branches or pull requests

2 participants