If 'db' is a DbContext in this method
var product = from s in db.Product
select s;
// fetch stuff in database
return new XmlResult(product);
Then you are not getting out a DataRow or DataTable, you're getting a collection of strongly typed classes. If you want make xml from them use this code:
public static string SerializeAsXml<T>(T element)
{
XmlSerializer xmlSerializer = new XmlSerializer(element.);
StringWriter textWriter = new StringWriter();
xmlSerializer.Serialize(textWriter, element.GetType());
return textWriter.ToString();
}
call it
var products = from s in db.Product
select s;
// fetch stuff in database
return SerializeAsXml(products);