GetMultiManyToOne(): Order of parameters changes.

Posts   
 
    
PatrickD
User
Posts: 65
Joined: 05-Sep-2006
# Posted on: 27-Jun-2007 16:41:11   

Hi,

I use the GetMultiManyToOne() method on an entitycollection for a table with multiple FK's. However, after generating code the order of the parameters changes. This happened to me twice the last couple of days. e.g. Table A has relations with B, C and D:

  • Original: ACollection.GetMultiManyToOne(IEntity BInstance, IEntity CInstance, IEntity DInstance)
  • Second generate code: ACollection.GetMultiManyToOne(IEntity DInstance, IEntity BInstance, IEntity CInstance)
  • Third generate code: ACollection.GetMultiManyToOne(IEntity CInstance, IEntity DInstance, IEntity BInstance)

The big problem with this is that parameter types are all of type IEntity, so you don't notice anything until runtime (Unit testing has saved me lots of trouble simple_smile )

Two of the relationships were created in the LLBLGen Pro studio as they relate to tables in a different database.

Note that there were no changes to the entity itself. Making changes to other entities and/or Refresh Catalog and regenerating code causes this problem.

Regards,

Patrick

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 27-Jun-2007 17:17:14   

Two of the relationships were created in the LLBLGen Pro studio as they relate to tables in a different database.

Note that there were no changes to the entity itself. Making changes to other entities and/or Refresh Catalog and regenerating code causes this problem.

I think this might happen if you modify the relations of the main entity in the Designer. (Hiding, un-hiding, adding, deleting).

I can see how it can cause problems. Let's check it out and get back to you, if we can do something about it.

PatrickD
User
Posts: 65
Joined: 05-Sep-2006
# Posted on: 27-Jun-2007 17:30:47   

Walaa wrote:

I think this might happen if you modify the relations of the main entity in the Designer. (Hiding, un-hiding, adding, deleting).

I have not made any changes to the relations of the main entity. I did however add a relation in the designer between one of the related entities and an entity which is not related to the main entity.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 28-Jun-2007 11:26:13   

Interesting find. The relations to traverse aren't sorted so if the order changes somehow, the output is different as well. The main user of these methods, lazy loading, is also updated with this order so it will work properly, what of course fails is your own code calling these methods.

I'm not sure if sorting the relations on related entity name will solve it. Renaming an entity then also changes the order.

I'll do some tests with v2.5 code (as this will be a breaking change, so I can't fix it in 2.0) by sorting the relations and typing the parameters to see if that will ease the pain somewhat. There were cast errors which caused us to use IEntity instead, I'll see if I can overcome that problem.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 01-Jul-2007 13:46:50   

This has been corrected in v2.5 (latest beta build)

Frans Bouma | Lead developer LLBLGen Pro