How to refetch entity view collections?

Posts   
 
    
Sokon1
User
Posts: 97
Joined: 17-Jul-2006
# Posted on: 28-Jul-2006 09:51:01   

I use an entity view collection with a filter to display and edit data from two tables. I want to add a "refresh" button, which reloads the whole collection. This ist what I found out:

1) I could set my entity collection to null and use the GetMulti(...) command again. But then i have an already loaded entity structure waiting in memory for the grabage collector to come.

2) If i understand correctly, the entity view collections don't come with data. They show a display of data stored in entities of the related tables. If i set the "alwayLoad"-Property of those entities to true, every GetMulti() would force a reload from the db. But how can that be? I added the entity "mapped on a view" in the designer, so there are no entity classes of any table available, whose properties i could set.

I just wondered if there is a simple way, say, using a "ReFetch()" or something. But i couldn't find one, so: What is the "best practice" for this?

Thanks in advance!

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 28-Jul-2006 15:42:04   

1) I could set my entity collection to null and use the GetMulti(...) command again. But then i have an already loaded entity structure waiting in memory for the grabage collector to come.

I didn't get the question, if there is any.

2) If i understand correctly, the entity view collections don't come with data. They show a display of data stored in entities of the related tables. If i set the "alwayLoad"-Property of those entities to true, every GetMulti() would force a reload from the db. But how can that be? I added the entity "mapped on a view" in the designer, so there are no entity classes of any table available, whose properties i could set.

I'm confused, are you talking about EntityView class which is used to create in-memory views on an entity collection object and allows you to filter and sort an in-memory entity collection without actually touching the data inside the entity collection. Or you are talking about entities mapped on database views.

Please elaborate more. Thanks

Sokon1
User
Posts: 97
Joined: 17-Jul-2006
# Posted on: 28-Jul-2006 16:00:08   

Oh, perhaps the Problem is that I mix up both "view" things. Ok, I'm talking about an entity mapped on a database view. I just wanted to know what is the best way of doing a refetch, so the entities are refilled with the original data from the DB.

sparmar2000 avatar
Posts: 341
Joined: 30-Nov-2003
# Posted on: 29-Jul-2006 18:45:07   

Have a look at the following thread that might help. http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=6551&HighLight=1.

In addition, I typically will de-reference the current entity and 'new' the entity so that it is fetched again from the database. However, I accept that this is an overhead as far as the GC is concerned.