Sorry if this is generic in nature, but I have a question that maybe is related to my lack of understanding of some core underlying rules of .NET and Silverlight.
I have a basic project at the moment that simply:
An ASP.NET generic handler writes out XML
Within Silverlight, I am using the WebClient object to get the XML output, in fact I have been running through Scott Gu's tutorial: Scott Gu's excellent tutorial
I have used the example of LINQ TO XML to essentially load the XML into a class collection.. for example:
XDocument saleslogdata = XDocument.Parse(e.Result);
var logrecords = from data in saleslogdata.Descendants("data")
where data.Element("logID") != null
select new SalesLog
{
logID = (int)data.Element("logID"),
name = (string)data.Element("name"),
};
grdSalesLog.ItemsSource = logrecords;
The class is as follows (just a basic example):
public class SalesLog
{
public int logID { get; set; }
public string name { get; set; }
}
SO MY MAIN QUESTION IS THIS...
Is there a way I can "auto generate" the class building part of the above example. In otherwords say if I need to add another 10 columns to the source XML, I obviously need to go into my silverlight app, change the above code to expand the class to incorporate the new fields, and of course the LINQ to XML query to map the new XML fields to the class.
Again, I am sure I am missing something fundemental here!