10
I have an ASP.Netet MVC project where I file a report that requires quite resource of the machine in question of processing.
I have a Action
that generates and another that returns the report data in an Object List, so I thought that by creating a static variable, I could save the report data and return it when needed.
private static List<MeuObjeto> DadosRelatorio = new List<MeuObjeto>();
public ActionResult MinhaAction ()
{
// Limpando dados que já estavam.
if (DadosRelatorio.Count() > 0)
{
DadosRelatorio.Clear();
}
...
// Preenchendo DadosRelatorio
...
}
public ActionResult OutraAction ()
{
return Json(DadosRelatorio, JsonRequestBehavior.AllowGet);
}
The problem is that when 2 or more users simultaneously generate a report, the data of one overwrites the data of another.
I thought that by creating a static variable itself framework would manage a variable for each one on the server, but that’s not what happens, the same variable is for all users.
Is there any alternative?
Enough resource how much? Millions of lines?
– Leonel Sanches da Silva
Exactly @Ciganomorrisonmendez , millions of lines.
– Jedaias Rodrigues