I finally have it working so that it does not take forever to clear out the llbl entities using this code:
Public Function LoadForms(ByVal application As ApplicationEntity) As EntityCollection(Of FormEntity)
Using Adapter As New DataAccessAdapter
For Each frm As FormEntity In application.Form
frm.FormTrait.Clear()
Next
Dim prefetchPath As IPrefetchPath2 = New PrefetchPath2(LLBL.EntityType.FormEntity)
prefetchPath.Add(FormEntity.PrefetchPathFormTrait)
Adapter.FetchEntityCollection(application.Form, application.GetRelationInfoForm, prefetchPath)
Return application.Form
End Using
End Function
So, instead of application.Form.Items.Clear, I go through each FormEntity and Clear the FormTrait Collection.
I don't know why I even have to clear the collection at all but if I don't, I have duplicate FormTraitEntities
So, even though I've somewhat resolve the problem, I would still like answers to why I have to do it at all and why when I Clear at the Form level it locks up for a long period of time.
Thanks,
Fishy
Edit: I just noticed that the code I just posted was using diffent tables then the original code. It is still basically the same problem and solution. I'll apply my solution to the original problem and let you know if it works. Sorry about that.