Open jkavimandan opened 7 years ago
+1
An item with the same key has already been added. at System.Collections.Generic.Dictionary
2.Insert(TKey key, TValue value, Boolean add)
at EntityFramework.Utilities.EFBatchOperation2.InsertAll[TEntity](IEnumerable
1 items, DbConnection connection, Nullable1 batchSize)
Does anyone have any idea what might be causing this?
I actually stopped usinf this utility. If you loop and add is still good. Didnt see any performance issues. Just do your own.
+1 getting the followin stack trace when apparently trying to insert an empty collection:
System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary``2.Insert(TKey key, TValue value, Boolean add) at EntityFramework.Utilities.EfMappingFactory.GetMappingsForContext(DbContext context) in D:\Projects\GSAP-X-API\src\Externals\EntityFramework.Utilities\MappingHelper.cs:line 312 at EntityFramework.Utilities.EFBatchOperation``2.InsertAll[TEntity](IEnumerable``1 items, DbConnection connection, Nullable``1 batchSize) in D:\Projects\GSAP-X-API\src\Externals\EntityFramework.Utilities\EFBatchOperation.cs:line 115
I couldn't reproduce the issue using integration tests. My current versions are:
EntityFramework = 6.1.3 EntityFramework.Utilities = 1.0.2.0
Job Message: Main Message: An item with the same key has already been added. Main Message Stack Trace: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary
2.Insert(TKey key, TValue value, Boolean add) at EntityFramework.Utilities.EfMappingFactory.GetMappingsForContext(DbContext context) at EntityFramework.Utilities.EFBatchOperation
2 .InsertAll[TEntity](IEnumerable1 items, DbConnection connection, Nullable
1 batchSize)This error occurs intermittently, though no duplicate key is being passed to the InsertAll().