how to refresh(refetch) xxxCollection?

Posts   
 
    
nevernet
User
Posts: 67
Joined: 01-Feb-2010
# Posted on: 25-Feb-2010 13:40:50   

xxxCollection atc = new xxxCollection();
atc.GetMulti(null);

after i added new row into database, but the xxxCollection was not refreshed.

how to refetch xxxCollection?

(llblgen pro 2.6 demo)

Thank you

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 25-Feb-2010 20:54:24   

Just call .GetMulti() again to refetch the collection.

Matt

nevernet
User
Posts: 67
Joined: 01-Feb-2010
# Posted on: 26-Feb-2010 01:08:14   

MTrinder wrote:

Just call .GetMulti() again to refetch the collection.

Matt

as i think this doesn't work.

Thank you

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 26-Feb-2010 05:21:14   

Doesn't work? Should work:

[TestMethod]
public void RefetchSS()
{
    // fetch the categories
    CategoryCollection categories = new CategoryCollection();
    categories.GetMulti(null);
    Assert.AreEqual(4, categories.Count);

    // add a new one
    CategoryEntity newCategory = new CategoryEntity();
    newCategory.Name = "New category";
    newCategory.Save();
                            
    // refetch
    categories.GetMulti(null);
    Assert.AreEqual(5, categories.Count);
}

If doesn't work please post the code snippet you are using.

David Elizondo | LLBLGen Support Team
nevernet
User
Posts: 67
Joined: 01-Feb-2010
# Posted on: 26-Feb-2010 06:02:44   

I just checked it again. yes, it works

i made a mistake before.

Thanks for all.