The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

missolonghi (1) [Avatar] Offline
#1
Hi all,

I have a quick LINQ-to-SQL subquery question which I would really appreciate some pointers on.

Supposing a large db with a parent table, child table, and subchild table. Something like Northwind's Customer, Order, and OrderLines.

I want to construct an XML document with information for all orders, partially based on data from the Order, and partially OrderLines tables, if and only if there are entries in OrderLines. I.e. there could be a blank order waiting to go but as this has not been filled out with related OrderLines it is not of interest.

Being new to LINQ I am slightly swimming with the best syntax necessary to get two typed entities Order and OrderLines in related fashion such that I can iterate through the relation and populate my XML document as described with information from each.

Any pointers would be greatly appreciated.
jwooley (123) [Avatar] Offline
#2
Re: Subquery question
Look at using "Any" as discussed in chapter 6 to find any records that have liens. In addition, since you know you will always fetch the associtated Orders and OrderLines with the Customers, you will likely want to specify the DataLoadOptions which we cover also in chapter 6 to avoid excessive round-trips to the database.

Jim