Composition Attribute not working

Posts   
 
    
ottoacosta
User
Posts: 34
Joined: 16-Aug-2007
# Posted on: 30-Mar-2011 14:44:31   
  • LLGLGen Pro V3.1
  • VS 2010
  • Silverlight 4
  • Oracle 10/11g

After adding the Composition attribute to the Navigator Collection on the designer and having it working for a while now I had to remove it because of compiling error when generating the client entity classes.
"Error 27 CompositionAttribute cannot be applied to member '<Member>'. CompositionAttribute can only be applied to members marked with AssociationAttribute.".

Also,

Is there a way to get a reference to parent entities without having to query for it. For example: getting the Product entity of an OrderDetail entity?

Thanks,

Otto.

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 31-Mar-2011 21:52:32   

What changed to make it stop working - new version of LLBLGen etc? Something must have caused it...?

You surely always have to query an entity to get it - I'm not sure what you mean otherwise...?

Matt

ottoacosta
User
Posts: 34
Joined: 16-Aug-2007
# Posted on: 31-Mar-2011 22:11:36   

Hi Matt, thanks for your response.

I removed the attribute just to get it to work and you are correct; it seems to have stopped working when I tried generated code with the new v3.1 designer. I have to re-visit it early next week.

What I meant is I would like to know which is the recommended way to get the parent entity of a lower level entity like the parent ProductEntity of a LineItemEntity. There is an attribute generated on the LineItemEntity called ProductEntity but it is null.

Thanks.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Apr-2011 20:18:13   

ottoacosta wrote:

Hi Matt, thanks for your response.

I removed the attribute just to get it to work and you are correct; it seems to have stopped working when I tried generated code with the new v3.1 designer. I have to re-visit it early next week.

ok

ottoacosta wrote:

What I meant is I would like to know which is the recommended way to get the parent entity of a lower level entity like the parent ProductEntity of a LineItemEntity. There is an attribute generated on the LineItemEntity called ProductEntity but it is null.

If you are using Adapter templateset, you must fetch the collection with a PrefetchPath. For more code examples see this: http://www.llblgening.com/archive/2009/10/prefetchpaths-in-depth/

If you are using SelfServicing, the parent entity will be loaded "on demand". However, you still can use PrefetchPaths in SelfServicing in some scenarios when you need to refine the performance (see this).

David Elizondo | LLBLGen Support Team