Hi,
Kentico version: 12.
We end in a tricky situation for a new site module and maybe we miss something here.
Short version:
We try to make a query to load an Info object from an InfoProvider that have children other Info object, is there a way to get the children as a list without having to make a Join query and then foreach the data manually to group them ?
Note: We did follow all the instruction here https://docs.kentico.com/k12/custom-development/creating-custom-modules/creating-custom-binding-classes but it explains how to setup not how to query with the info provider
Long version:
We created a module and we have 3 Main Info classes, A, B, C.
A: [Id], [Name]
B: [Id], [Name]
C: [Id], [Name]
Now we have 2 other Info class X and Y that are used to manage the many to many relationship between them:
X: [A.Id], [B.Id]
Y: [A.Id], [C.Id]
So A have B and C objects has children, really a classic structure...
In Entity Framework it would be quite simple to query that by just having 2 virtual Properties on A defining the relationship and it would load the children automatically into A, something like that:
public virtual List<B> bChildren {get; set;}
public virtual List<C> cChildren {get; set;}
Is it possible to query A with Kentico that loads the sub objects, or define something that will make it load these objects.
The only way I see after reading the documentation right now would be either to Left join and merge the data in the code or make 3 query and merge the data in the code too.
As it is pretty standard I hope there is something a bit better than foreach the data...
Thanks.