Newb. ProductEntity fetch OK, collection fetch EMPTY

Posts   
 
    
domagoj
User
Posts: 2
Joined: 01-Nov-2007
# Posted on: 01-Nov-2007 14:19:43   

Hi,

I just started checking the demo, and everything looks great, but something is bugging me. TKategorijaEntity - represents category entity. I fill it by using primary key value 11, and it fills OK. But when I try to fill its entity collection named TartikalCollectionViaTartikalKategorija - represents product entity via linked table, everything goes OK but TartikalCollectionViaTartikalKategorija entity collection after FetchEntityCollection is empty, and it shouldn't be (has value in the database).

SQL server 2005 EXPRESS, .NET 2.0, windows application.

Can anyone help me?

DB.EntityClasses.TKategorijaEntity ent = new DB.EntityClasses.TKategorijaEntity(11);
            DB.DatabaseSpecific.DataAccessAdapter daa = new DB.DatabaseSpecific.DataAccessAdapter(CONNSTR, true);
            daa.FetchEntity(ent);
            daa.FetchEntityCollection(ent.TartikalCollectionViaTartikalKategorija, ent.GetRelationInfoTartikalCollectionViaTartikalKategorija());
            daa.CloseConnection();

Best regards, Domagoj

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 01-Nov-2007 14:39:33   

Try the following code:

        DB.EntityClasses.TKategorijaEntity ent = new DB.EntityClasses.TKategorijaEntity(11);
        DB.DatabaseSpecific.DataAccessAdapter daa = new DB.DatabaseSpecific.DataAccessAdapter(CONNSTR, true);
        PrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.TKategorijaEntity);
        prefetchPath.Add(TKategorijaEntity.**PrefetchPathTartikalCollectionViaTartikalKategorija**);

        daa.FetchEntity(ent, prefetchPath);

I'm not sure about the exact syntax of the bold part, but intellisence should help you out.

domagoj
User
Posts: 2
Joined: 01-Nov-2007
# Posted on: 01-Nov-2007 14:52:08   

Oh, sorry, I found the mistake, linking table in the DB was empty disappointed frowning (long story)

Now it works both ways, thank you...