Compile error on self-referencing subtype

Posts   
 
    
paulshealy
User
Posts: 22
Joined: 13-Jun-2005
# Posted on: 01-Aug-2006 16:27:26   

I have a subtype of Position, GPPosition, with a self-reference called NonHotelColumn (using self-servicing, 2.0). When I move this field to the subtype, rather than leaving it in Position, I get several compile errors in the generated code that attempts to reference PositionFieldIndex.NonHotelColumn. For example: in PositionRelations, I have


public virtual IEntityRelation PositionEntityUsingNonHotelColumn
        {
            get
            {

                IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany);
                relation.StartEntityIsPkSide = true;
                relation.AddEntityFieldPair(EntityFieldFactory.Create(PositionFieldIndex.ID), EntityFieldFactory.Create(PositionFieldIndex.NonHotelColumn));
                relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("PositionEntity", true);
                relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("PositionEntity", false);
                return relation;
            }
        }

I have a similar problem in PositionDAO.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 01-Aug-2006 18:43:20   

This is caused by a strange thing in your project: the relation Position -> Postion (m:1), namely Position.NonHotelColumn -> Position.Id

is defined on Position, but that's wrong, the designer should have unmapped this relations because NonHotelColumn isn't part of Position, it's not mapped there.

Bug no. 3 found with this project. flushed I think it's all related to an incorrectly working relation detection routine, which caused a couple of issues you ran into. I hope to have a fix for you tomorrow (wednesday).

Frans Bouma | Lead developer LLBLGen Pro
paulshealy
User
Posts: 22
Joined: 13-Jun-2005
# Posted on: 01-Aug-2006 19:11:21   

Otis wrote:

Bug no. 3 found with this project. flushed I think it's all related to an incorrectly working relation detection routine, which caused a couple of issues you ran into. I hope to have a fix for you tomorrow (wednesday).

Thanks for the help. 3 bugs - do I get a free t-shirt? wink

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 02-Aug-2006 07:40:06   

A free T-shirt is earned after the 100th bug wink

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 02-Aug-2006 14:07:58   

smile

The bug in question is caused by the fact that when a field is unmapped, a relation with self over that field isn't removed. Fixed in next build.

Frans Bouma | Lead developer LLBLGen Pro