Refresh EntityCollection from database

Posts   
 
    
Rosacek
User
Posts: 155
Joined: 18-Mar-2012
# Posted on: 13-Sep-2012 21:58:53   

Hi, what is the right way to refresh entitycollection from database?

When simply use following code, only new records from DB are added to entitycollection, but updated records are not affecting my entity collection.


Using adapter As New DataAccessAdapter()
         adapter.FetchEntityCollection(ecCustomers, Nothing)
End Using

It works fine if I call ecCustomers.Clear() first, and then fetch


Using adapter As New DataAccessAdapter()
         ecCustomers.Clear()
         adapter.FetchEntityCollection(ecCustomers, Nothing)
End Using

Is there any better way how to refresh from DB?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 14-Sep-2012 06:55:22   

Clearing the collection is a good idea actually, also because may be elements that are not anymore in DB.

David Elizondo | LLBLGen Support Team