I have latest LLBL, using adapter.
I found issue with EC.AddRange performance when EC is in Context
Scenario:
Say I want "refresh" ecManagedCollection
First I fetch entities into ecTempCollection and if some conditions are ok, then I want to put those entities to ecManagedCollection.
Very simple code looks like:
Dim myContext As New Context()
myContext.Add(ecManagedCollection)
Using adapter As New DataAccessAdapter()
Dim ecTempCollection As New HelperClasses.EntityCollection(Of myEntityType)()
adapter.FetchEntityCollection(ecTempCollection)
ecManagedCollection.Clear()
ecManagedCollection.AddRange(ecTempCollection)
End Using
If I fetch 10k records then command "ecManagedCollection.AddRange(ecTempCollection)" takes about 10-20seconds.
If I disable using context by comment out "myContext.Add(ecManagedCollection)" then fetching 10k records takes 0,5sec
If I use Context but I do not use ecTempCollection, I fetch directly to ecTempCollection, then it takes also 0,5 sec.
Means looks like using Context brings huge overhead into .AddRange.
Could you look at that?
I tried in different apps, different databases and different DAL code.
Same result, when EC is in Context then EC.AddRange is 10-20x slower that direct fetch or when using ecTemp+not using context.