Click here to Skip to main content
15,879,096 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I would like to implement ORM framework. I'm interested in loading related objects. I want to load an object and it's relation by one query. For instance: load CustomerOrder its OrderLines (CustomerOrder.OrderLines ) + CustomerOrder.OrderLines.Products. I need to join 3 tables here but need an article or book about how to transfer joined data to object. I'll implement it in c#, but mostly interested in how to transform joined table data into a graph object with complex structure. Handle loop references etc. Just need some guid how to write such functionality or reference to a topic how EF internally does it.
Posted
Updated 20-Aug-15 0:37am
v2
Comments
Tomas Takac 20-Aug-15 6:24am    
It's not entirely clear. Do you mean how to populate the object with the data from database? What programming language?
Member 11355698 20-Aug-15 6:37am    
updated info
Tomas Takac 20-Aug-15 6:44am    
I don't think you should join the data, that will create a lot of duplication. You should do it step by step. 1) select customer 2) select all orders for that customer 3) for each order select lines...
Member 11355698 20-Aug-15 6:49am    
But as far as I know EF does it by only one query to the database. If you use eager loading (Include(Obj.InnterObj1.Innerobj2)) then in creates joins and trasform the data to entities. The point is that one query works fater than many separate requests
Tomas Takac 20-Aug-15 10:47am    
I'm using NHibernate right now and it does it one by one. Nevertheless if you order it by id's (ObjId, InObjId, InInObjId) then you just walk the list and on each id change you create a new object.

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