> using (var context = new PICSEntities(Config.model.SqlServer)) > { > var q = from p in context.Parcels > join t in context.TransactionDetails on p.Parcels_Id equals t.Parcels_Id > select new > { > Parcels_Id = p.Parcels_Id, > Goods = p.GoodsType.Description, > Inventory = p.ParcelInventoryType.Description, > RSReference = p.RSReference, > Transaction_Nr = t.TransactionHeaders_Id, > Transaction_Type = t.TransactionHeader.TransactionType.Description, > Date = t.TransactionHeader.TransactionDate, > Weight = t.Weight, > Amount = t.Amount > }; > } >>
> using (var context = new PICSEntities(Config.model.SqlServer)) > { > XDocument asXmlDocument = > new XDocument( > new XDeclaration("1.0", "utf-8", ""), > new XElement("Parcels", > from p in context.Parcels > join t in context.TransactionDetails on p.Parcels_Id equals t.Parcels_Id > select new XElement("Parcel", > new XAttribute("Parcels_Id", p.Parcels_Id), > new XAttribute("Goods",p.GoodsType.Description), > new XAttribute("Inventory", p.ParcelInventoryType.Description), > new XAttribute("RSReference", p.RSReference), > new XAttribute("Transaction_Nr", t.TransactionHeaders_Id), > new XAttribute("Transaction_Type", t.TransactionHeader.TransactionType.Description), > new XAttribute("Date", t.TransactionHeader.TransactionDate), > new XAttribute("Weight", t.Weight), > new XAttribute("Amount", t.Amount) > ) > ) > ); > using (XmlWriter xw = XmlWriter.Create(@"c:\docs\q.xml")) > { > asXmlDocument.Save(xw); > } > > } >>