I
ian
Hi, I have a really simple web service
public class MyService : System.Web.Services.WebService
{
[WebMethod]
public double[] DoWork (string pFunction )
{
return IDoTheWork.GetInstance().DoWork(pFunction);
}
}
In the same project I have singleton as follows.
sealed public class IDoTheWork
{
private static readonly IDoTheWork mInstance=new IDoTheWork();
private IDoTheWork()
{
...
}
public static IDoTheWork GetInstance()
{
return mInstance;
}
...
}
My question is at what point does the static member get initialised and
how long will it survive? If a client PC consumes the webservice and
then disconnects and consumes it again in a few hours, will they get the
same instance of mInstance?
Thanks
Ian
public class MyService : System.Web.Services.WebService
{
[WebMethod]
public double[] DoWork (string pFunction )
{
return IDoTheWork.GetInstance().DoWork(pFunction);
}
}
In the same project I have singleton as follows.
sealed public class IDoTheWork
{
private static readonly IDoTheWork mInstance=new IDoTheWork();
private IDoTheWork()
{
...
}
public static IDoTheWork GetInstance()
{
return mInstance;
}
...
}
My question is at what point does the static member get initialised and
how long will it survive? If a client PC consumes the webservice and
then disconnects and consumes it again in a few hours, will they get the
same instance of mInstance?
Thanks
Ian