Problems migrating LLBLGen Pro v5.3 -> v5.4

Posts   
 
    
SanderF
User
Posts: 125
Joined: 11-Dec-2006
# Posted on: 04-Jun-2018 08:29:29   

Hi,

I've migrated my source from v5.3 to v5.4, but i've a problem with compiling the new source. I've followed the breaking changes section in Documentation/Designer/BreakingChanges.htm but i have still a compiling problem.

The boolean EntityCore.LLBLGenProIsSubType() isn't there anymore. I have a general routine which gives the name of the SuperType back by the following code:

public string SuperTypeEntityName
        {
            get
            {
                if (this.LLBLGenProIsSubType)
                {
                    IInheritanceInfo inheritanceInfo = ModelInfoProviderSingleton.GetInstance().GetInheritanceInfo(this.GetType().Name, true);
                    return inheritanceInfo.SuperTypeEntityName.Replace("Entity", "");
                }
                else

                return this.EntityName;
            }
        }

To which code can i change this?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 04-Jun-2018 11:29:48   

Use this.GetEntityStaticMetaData().IsSubType instead.

Sorry for not documenting this. We'll add it to the breaking changes.

You attached a screenshot about another problem. That problem has been resolved?

Frans Bouma | Lead developer LLBLGen Pro
SanderF
User
Posts: 125
Joined: 11-Dec-2006
# Posted on: 04-Jun-2018 11:35:34   

Thanks, but you mean: this.GetEntityStaticMetaData() as a method? The return type has no property or method IsSubType...

I've removed the attached screenshot, that probem is solved :-)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 04-Jun-2018 11:45:16   

Oh my mistake... that whole type is internal... flushed Sorry I didn't check that.

This should do the trick:


public string SuperTypeEntityName
{
    get
    {
        IInheritanceInfo inheritanceInfo = ModelInfoProviderSingleton.GetInstance().GetInheritanceInfo(this.GetType().Name, true);
        if(inheritanceInfo==null || string.IsNullOrEmpty(inheritanceInfo.SuperTypeEntityName))
        {
            return this.EntityName;
        }
        return inheritanceInfo.SuperTypeEntityName.Replace("Entity", "");
    }
}

the GetInheritanceInfo() call is basically O(1) as it does a lookup first, so non-inheritance entities won't be slow here. The inheritance info is static data so the isnullorempty won't be slow here either.

Frans Bouma | Lead developer LLBLGen Pro
SanderF
User
Posts: 125
Joined: 11-Dec-2006
# Posted on: 04-Jun-2018 12:09:48   

Thanks!

SanderF
User
Posts: 125
Joined: 11-Dec-2006
# Posted on: 04-Jun-2018 12:42:59   

I've got a little other thing:

The breaking changes say:

public List<IEntityRelation> GetAllRelations()
        {
            return GetEntityStaticMetaData().GetAllRelations();
        }

but i need to use

public new List<IEntityRelation> GetAllRelations()
        {
            return GetEntityStaticMetaData().GetAllRelations();
        }

otherwise i get an error about: 'hides inherited member....' Do i have to use the keyword 'new'?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 04-Jun-2018 12:54:00   

Ah that's a typo. Your method should simply be named differently and call this.GetAllRelations(). But you don't have to, you can simply use IEntityCore.GetAllRelations(), and it will return all relations of the entity.

so in short:

var allRelations = ((IEntityCore)myCustomer).GetAllRelations();

Will update the docs.

Frans Bouma | Lead developer LLBLGen Pro