"The prefetch path element at index ..." error using Prefetchpath

Posts   
 
    
YoKnows
User
Posts: 3
Joined: 04-Jan-2007
# Posted on: 01-Feb-2007 23:18:50   

Hi,

Can't figure out why this error is happening. I'm not the most experienced user of LLBLGen but have used it on previous projects in the past with no issues.

Getting the following error:

The prefetch path element at index 0 in the passed in prefetch path for root entity type 12 is meant for root entity type 0 which isn't a subtype of 12. This means that you've added a prefetch path node to a Path of an unrelated entity, like adding OrderDetailsEntity.PrefetchPathProduct to a prefetch path for CustomerEntity.

On this line of code:


            UserEntity theUser = new UserEntity(UserId);

            IPrefetchPath2 path = new PrefetchPath2((int)EntityType.UserEntity);
            path.Add(UserEntity.PrefetchPathAddress);
            path.Add(UserEntity.PrefetchPathAddress.SubPath.Add(AddressEntity.PrefetchPathLuprovince));

using (DataAccessAdapter da = new DataAccessAdapter())
            {
                da.FetchEntity(theUser, path);
            }

The problem is the subpath I am adding. This is the DB schema: User TABLE: AddressID

Address TABLE: AddressID ProvinceID

LuProvince TABLE: ProvinceID

It must be something trivial.

What did I do wrong?

Thanks.

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 02-Feb-2007 03:26:46   

try this instead


UserEntity theUser = new UserEntity(UserId);

            IPrefetchPath2 path = new PrefetchPath2((int)EntityType.UserEntity);
            path.Add(UserEntity.PrefetchPathAddress).SubPath.Add(AddressEntity.PrefetchPathLuprovince);

using (DataAccessAdapter da = new DataAccessAdapter())
            {
                da.FetchEntity(theUser, path);
            }

YoKnows
User
Posts: 3
Joined: 04-Jan-2007
# Posted on: 07-Feb-2007 16:13:34   

Thanks VERY much.