My stored procedure returns data in following format
Hierarchy
table:
ParentId ChildId ParentName ChildName
1 9 AAA BBB
1 10 AAA CCC
1 11 AAA DDD
This data can be linked to a main table which holds other properties of parent and child entities such as Name
etc.
Person
table:
Id Name Age
1 AAA 40
Id
in Person
table is linked to Hierarchy
table.
I need to convert this to following
Public Class HierarchyData
{
public Person Parent {get;set;}
List<Person> Children {get;set}
}
I am calling a stored procedure and storing output in var.
this.context.ExecuteQuery<Hierarchy>(MyStoreProc, Paramerters);
Public Class Hierarchy
{
public int ParentId {get;set;}
public int ChildId {get;set;}
}
Can you please suggest how it can be converted to List<HierarchyData>
?