I'm trying to select out a couple of fields in a collection inside of collection. Roles->Users (name and ID) I was able to get flattened data using select many, but now I need to merge it back to a collection objects so my json is formatted correctly. I would like to do this in dynamic linq if possible otherwise I will might have to manually merge the objects back together. Any help would be great.
User->User_Roles->Roles (many to many relationship with User_Role as the join table)
q = query.SelectMany("USER_ROLES","new (inner as myUSER,outer as myROLE) ").SelectD("new (myROLE.ID as ROLE_ID, new( myROLE.NAME, myUSER.USER.FIRSTNAME,myUSER.USER.ID)as user)")
The results look like this:
Role A-> User A
Role A-> User B ..notice the repeat of "Role A"
Role A-> User C
it should be
Role A -> User A
+ User B
+ User C