Migrating from 2.6 to 5.7, InheritanceInfo

Posts   
 
    
ArtemK
User
Posts: 2
Joined: 18-Sep-2020
# Posted on: 18-Sep-2020 11:19:27   

Hello,

I am migrating a rather old project from 2.6 straight to 5.7

I would need help with building the dynamic relations. So in the old code I have things like this:


IEntityRelation rb = new EntityRelation(RelationType.OneToMany);
rb.StartEntityIsPkSide = true;
rb.AddEntityFieldPair(CorporationHierarchyListItemFields.UnitID, AccountFields.BusinessUnitID);
rb.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("CorporationHierarchyListItem", false);
rb.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("AccountEntity", true);
filter.Relations.Add(rb, JoinHint.Inner);

So basically it's an inner join between a view and a table.

I'd guess I need to convert this to DynamicRelation? but then I could not figure out how to do it if one part is a view?

Thanks, Artem

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 18-Sep-2020 19:03:48   

You can map the view to an entity. And thus you would be able to build this dynamic relation, or define it in the LLBLGen Pro Designer, so you don't need to create it in code.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 19-Sep-2020 10:10:15   

In v5 we also have 2 additional query systems, Linq and QuerySpec which make it much easier to write queries than the low-level API you're using in v2 simple_smile

Frans Bouma | Lead developer LLBLGen Pro
ArtemK
User
Posts: 2
Joined: 18-Sep-2020
# Posted on: 21-Sep-2020 16:51:12   

Thanks!

Yep, we are about 10 years late, so we have quite some catch up to do wink

Mapping the view to the entity -> yep, thanks, works. It looks like although the project is using v2.6 most of the concepts are from 1.0, so I just need to manually change all those things.

Linq and QuerySpec -> yep, looking into them, the code is much cleaner, very nice; I guess the existing stuff we might leave as it is, but the new code we start writing using one of these.

Thanks guys simple_smile