The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Loading related entities in one database call - LINQ's DataShape

Last post 05-14-2008, 8:14 PM by jstuparitz. 2 replies.
Sort Posts: Previous Next
  •  05-13-2008, 6:00 PM 9274

    Loading related entities in one database call - LINQ's DataShape

    Hey everyone,

    I'm sure you know of a feature of LINQ to load part of an object gragh in a single request via it's DataShape class and LoadWith method.  This would be a great feature to have so that we could load related entities at once (or even what appears to be at once even if they are separate queries under the covers).  Right now I'm finding myself using loops with multiple queries or if it's really costly to get related data...writing a query and linking the object graph manually with loops.

     Any plans or thoughts on this? Or is there a feature already that I'm not even taking advantage of?  This would be huge!

     Thanks,

    Justin

  •  05-13-2008, 9:20 PM 9277 in reply to 9274

    Re: Loading related entities in one database call - LINQ's DataShape

    Well, first are you aware of our hierarchical data model? With it there is no reason to be writing loops. There's an option on the Generated Master that will generate your complete hierarchical model. And yes, we are aware of LINQ's feature for doing this, we have pretty good LINQ support in fact in our next beta as you can tell on our blog. I'm not sure if we'll have the feature in there, we might though, there's just so much to learn on all this. So are you using our hierarchical model?



    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  05-14-2008, 8:14 PM 9308 in reply to 9277

    Re: Loading related entities in one database call - LINQ's DataShape

    Thanks for the reply.  I'm definitly using the hierarchical model.  It works very well in most cases and I like it alot.  There are times however when I want to get data from one entity and a related entity in one shot or at maximum with two queries.  For example, say I have a contact object and a related address object.  I do a search and get 50 contacts, but I also want to get all the related addresses right now.  Using the hierarchical model this translates into another 50 queries to the database or I have to write my own query so that I'm only calling the database once more and then linking up the entities via a loop.  This is less expense, but more work for me.  My best example in requiring this is in a chunky document style web service where methods provide a complete package of information so as to limit the number of service requests.

     

View as RSS news feed in XML