Inheritance error: multiple definitions with identical signatures

Posts   
 
    
trevorg
User
Posts: 104
Joined: 15-Nov-2007
# Posted on: 23-Nov-2007 22:29:34   

I have a simple TargetPerEntity inheritance hierarchy based on the following tables:

USER

USER_ID FIRST_NAME LAST_NAME

MANAGER

USER_ID REGION AUTH_LEVEL

USER_ID is the primary key in both tables, a 1 to 1 relationship is defined on USER_ID

I let LLBLGen create this inheritance hierarchy using "Construct target-per-entity hierarchies', and as expected, Manager shows up as a sub-type of User. When I generate the code, I find that the column USER_ID, which exists in both tables, is now conflicting in 2 spots in the generated code:

1) Public Shared ReadOnly Property userid() As SD.LLBLGen.Pro.ORMSupportClasses.EntityField' has multiple definitions with identical signatures. 2) 'UserId' is already declared in this enum. ConstantsEnums.vb No other compile errors occur

Is having the same column name in examples like this forbidden??

What is the proper way to handle this scenario?

I've tried to find the solution in the documentation, but no luck...

LLBLGen Pro V2.5 VB.Net, Self Servicing, .Net 2.0, VS2005

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 24-Nov-2007 01:58:03   

Hi trevorg,

This shouldn't happen. LLBLGen should create for that class (Manger) in the enum class two fields: UserId_User and UserId.

Please regenerate the code in a separate empty folder and let us know if the compilation problem persists.

Regard,

David Elizondo | LLBLGen Support Team
trevorg
User
Posts: 104
Joined: 15-Nov-2007
# Posted on: 26-Nov-2007 21:46:49   

daelmo wrote:

Hi trevorg,

This shouldn't happen. LLBLGen should create for that class (Manger) in the enum class two fields: UserId_User and UserId.

Please regenerate the code in a separate empty folder and let us know if the compilation problem persists.

Regard,

Hi Daelmo,

I am starting to think this is either a little bug, or else there is a manual intervention step I must do in these situations?

I will upload the MS Access database I am using for this. If you try it yourself, you'll see that the error does in fact occur.

Here are the enumerations that result:

Public Enum XsysUserFieldIndex [Userid] [FirstName] [LastName] [ActiveFg] [CreateUserid] [CreateDttm] [LastUpdateUserid] [LastUpdateDttm] AmountOfFields End Enum Public Enum XsysUserManagerFieldIndex [Userid] ' <---------------- [FirstName] [LastName] [ActiveFg] [CreateUserid] [CreateDttm] [LastUpdateUserid] [LastUpdateDttm] [UserId] ' <---------------- [AuthLevel] [Responsibilities] AmountOfFields End Enum

And then there is also the other problem with: Public Shared ReadOnly Property userid() As SD.LLBLGen.Pro.ORMSupportClasses.EntityField' has multiple definitions with identical signatures.

If I go and rename the UserID property in the Manager subclass (in LLBLGen) to ManagerID, it clears up the problem. But from your response, it seems I am getting behavior other than what is intended?

I am using LLBLGen Pro Version 2.5 Final Demo (Oct 25th 2007)

Thanks, Trevor

SEE ATTACHED MDB FILE

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 27-Nov-2007 07:30:07   

I think I found the problem:

USER
------------
USER_ID
FIRST_NAME
LAST_NAME

MANAGER
------------
USER_ID
REGION
AUTH_LEVEL

At your MDB file the signatures aren't identical. You have XSYS_USER.USERID and XSYS_USER_MANAGER.USER_ID. When you refresh at your LLBLGen Designer that is resulting in **XsysUser.Userid **and **XsysUserManager.UserId **(note the "i" vs. "I") that technically aren't the same. That's why the generating process doesn't make a special name for the inherited field. If you make the both entity field names the same, that will come into:

/// <summary>
/// Index enum to fast-access EntityFields in the IEntityFields collection for the entity: XsysUserManager.
/// </summary>
public enum XsysUserManagerFieldIndex:int
{
    ///<summary>Userid. Inherited from XsysUser</summary>
    Userid_XsysUser,
    ///<summary>FirstName. </summary>
    FirstName,
    ///<summary>LastName. </summary>
    LastName,
    ///<summary>ActiveFg. </summary>
    ActiveFg,
    ///<summary>CreateUserid. </summary>
    CreateUserid,
    ///<summary>CreateDttm. </summary>
    CreateDttm,
    ///<summary>LastUpdateUserid. </summary>
    LastUpdateUserid,
    ///<summary>LastUpdateDttm. </summary>
    LastUpdateDttm,
    ///<summary>Userid. </summary>
    Userid,
    ///<summary>AuthLevel. </summary>
    AuthLevel,
    ///<summary>Responsibilities. </summary>
    Responsibilities,
    /// <summary></summary>
    AmountOfFields
}

So, it is just a little typo wink

David Elizondo | LLBLGen Support Team
trevorg
User
Posts: 104
Joined: 15-Nov-2007
# Posted on: 27-Nov-2007 17:47:42   

Ah ok, I added an underscore in the Manager table UserID column.

Thanks!