LivePersistence with "Fields on related fields"

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 28-Sep-2009 18:26:17   

I have a grid bound to a "Product" entity thru a LLBLDataSource set to Live Persistence.

Works great. No code. Wow.

In the system a Store has Products, a simple 1:M

Using the Fields on Related fields fields feature of the LLBL editor, I added "StoreName" to the Products entity.

On the grid I bind another column to the Product.StoreName but it's always null.

Is there a way, without code, to tell the LLBLDataSource to fetch the StoreName too? It is set to ReadOnly.

ian

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 29-Sep-2009 02:50:31   

Hi Ian,

You are using Adapter, so no automatic fetchs take place for you.

You should add a prefetch path, maybe on you r Page_Load. For example:

if (!IsPostBack)
{
     IPrefetchPath2 path = new PrefetchPath((int) EntityType.ProductEntity);
     path.Add(ProductEntity.PrefetchPathStore);
     _myLLBLGenProDS.PrefetchPathToUse = path;
}

The same applies for filter (FilterToUse), sort (SorterToUse) and relations (RelationsToUse).

David Elizondo | LLBLGen Support Team