Click here to Skip to main content
15,893,508 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a table "ParentChild" like this:

https://i.stack.imgur.com/ybypN.png[^]

I want to get all childs from a parent by using EntitySpaces ORM but i can not do

What I have tried:

This is my code:

ParentChildCollection pc = new ParentChildQuery("c", out var c)
            .Where(c.ParentId==0)
            .InnerJoin<ParentChildQuery>("e", out var e)
            .On(c.ParentId== e.Id)
            .ToCollection<DeviceCategoryCollection>();

But i dont get expected result.

Everybody can help me? Thanks
Posted
Comments
Richard Deeming 15-Dec-20 4:15am    
You have already posted this on the GitHub project, which is the correct place to ask this:
How to implement Recursive Queries Using Common Table Expressions · Issue #26 · MikeGriffinReborn/EntitySpaces · GitHub[^]
Bill Lee Vn 15-Dec-20 6:03am    
Yes, i asked for this problem there but it seems that Mike Griffine has been offline long time. So i post my question here with hope that someone has experiences with EntitySpaces can help me
[no name] 15-Dec-20 10:36am    
Maybe just try retrieving children for a given key. The size and complexity of an SQL / LINQ query is directly proportional to the lack of experience of the coder.
Bill Lee Vn 15-Dec-20 20:31pm    
yes, this is the fist time i work with sql server
[no name] 15-Dec-20 23:12pm    
From the looks of it, you have a one-to-one relationship, with one orphan. You have a "database integrity" problem, and "Entity Spaces" doesn't seem to be doing you any good.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900