First, I don't want to use a database or a local file.
Is it possible to store variables in memory so they don't have to be created each time the webservice is called? The problem is that
FullCompanyListCreateXML();
takes about 1 Minute to create the XDocument. So is there any way to prevent that the xml variable is dropped after the webservice call is finished?
[WebMethod(CacheDuration = 120)]
public String FullCooperationListChunkGet(int part, int chunksize)
{
StringBuilder output_xml = new StringBuilder();
XDocument xml = FullCompanyListCreateXML();
IEnumerable<XElement> xml_query = xml.Root.Elements("Cooperation").Skip(part * chunksize).Take(chunksize);
foreach (XElement x in xml_query)
{
output_xml.Append(x.ToString());
}
output_xml.Insert(0, "<Cooperations>");
output_xml.Append("</Cooperations>");
return output_xml.ToString().Zip();
}
Thanks,
Henrik