This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, In LINQ it is possible to retrieve hierarchical data as a set of objects: Customer -> Orders -> OrderDetails LINQ syntax: var query = from c in db.Customers select new {City = c.City, orders = from o in c.Orders select new {o.OrderId} };
gives: City = Helsinki order=... orders: OrderId=10615 orders: OrderId=10615 City = London order=... orders: OrderId=11111 orders: OrderId=22222
Is this possible using Lightspeed and its Unit Of Work or can you only retrieve data in grid-format, like using SQL on its own. If it is, can you give an example using the hierarchy above? Thanks |
|
|
It is possible, but in most cases the projection will be performed client-side i.e. we will retrieve all the entities and then select the appropriate properties from those entities. In your example we would retrieve the Customers, each of the associated Cities and each of the associated Orders collections. It is therefore very important to set up eager loading appropriately (you can use named aggregates to tailor this to the query) to avoid a n+1 problem. |
|