Problem prefetchpath and subtypes

Posts   
 
    
G.I.
User
Posts: 172
Joined: 09-Jun-2005
# Posted on: 03-Aug-2007 10:39:33   

Hi,

I have a ProjectEntity, related to this entity is a SubProject and an ExternalProject. Each of these are also related to ProjectType.

When i try this code:

            IPrefetchPath2 path = new PrefetchPath2(EntityType.ProjectEntity);
            path.Add(ProjectEntity.PrefetchPathExternalProjects);
            path.Add(ProjectEntity.PrefetchPathSubProjects);
            path.Add(SubProjectEntity.PrefetchPathProjectType);
            path.Add(ExternalProjectEntity.PrefetchPathProjectType);

It gives the following error:

The PrefetchPathElement you to tried to add is already added to this PrefetchPath. Parameter name: elementToAdd

How can i fix this?

Best regards,

G.I.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Aug-2007 11:46:31   

Hi G.I.

You must to use SubPaths. Please read this thread for explanation: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=9264

Your code should look like:

IPrefetchPath2 path = new PrefetchPath2(EntityType.ProjectEntity);

path.Add(SubProjectEntity.PrefetchPathProjectType);

path.Add(ProjectEntity.PrefetchPathExternalProjects)
     .SubPath.Add(PrefetchPathProjectType);

path.Add(ProjectEntity.PrefetchPathSubProjects)
     .SubPath.Add(PrefetchPathProjectType);

path.Add(ExternalProjectEntity.PrefetchPathProjectType)
     .SubPath.Add(PrefetchPathProjectType);

Hope helpful wink

David Elizondo | LLBLGen Support Team
G.I.
User
Posts: 172
Joined: 09-Jun-2005
# Posted on: 03-Aug-2007 12:54:41   

ok ... it's working now ...