MikaelEliasson / EntityFramework.Utilities

Provides extensions for EntityFramework that doesn't exist out of the box like delete and update by query and bulk inserts
443 stars 175 forks source link

Resolved 2 issues with multi threaded code for issue #57 #61

Open RubberChickenParadise opened 9 years ago

RubberChickenParadise commented 9 years ago
  1. Fixed identified issue in SqlQueryProvider.cs UpdateItems where using DateTime.Now.Ticks could cause duplicate table names if calls to update happened fast enough for the same main table.

Fixed by switching to GUID

  1. Fixed race condition in MappingHelper.cs EfMappingFactory where 2 threads could evaluate if (!cache.TryGetValue(type, out mapping)) before either one had added the context type to the internal cache.

Fixed by adding a lock around the code to add the item to the cache dictionary to prevent 2 threads trying to add the same item.