i have alot of tables with alot of columns and want to generate xml using linq without having to specify the column names. here's a quick example:
users --------------- user_id name email user_addresses --------------- address_id user_id city state
this is the xml i want to generate with linq would look like
<user>
<name>john</name>
<email>[email protected]</email>
<address>
<city>charleston</city>
<state>sc</state>
</address>
<address>
<city>charlotte</city>
<state>nc</state>
</address>
</user>
so i'm guessing the code would look something like this:
var userxml = new XElement("user",
from row in dc.Users where user.id == 5
select (what do i put here??)
);
i can do this for one table but can't figure out how to generate the xml for a linked table (like user_addresses).
any ideas?