Good morning, I know that the title is a bit confusing but I will try to explain my problem.
I am working on a software that consumes several web services, to do a series of CRUD operations, what I am trying to do is to optimize the program a bit, so that every time you open a form, you do not install the web services that you use said form.
To do this create a class clsincio that insatancia all web services that uses all software at the time of login, in this way.
public class ClsInicio
{
public SerEnajenacionBienesService SerEnajenacion;
public ServiciosGeneralesCompService SerGeneralesComp;
public ServiciosAccesoriasCompService SerAccesoriasComp;
public ServiciosDocumentosService SerDocumentos;
public Funciones SerFunciones;
}
public void MtdCargar()
{
SerEnajenacion = WS.SerEnajenacionBienesService(); return;
.
.
.
}
now the problem is that I do not know how to access the instance I made in this class
since if from a form I do the following
clsinicio inicio = new clsinicio();
inicio.SerEnajenacion...... etc
I get an error because the service is set to null, I guess to do new on the class.
I think it can be done with some inheritance, but I'm not sure how it would be, since in most of the time I have to do inheritance from the class clsinicio to form forms.
I hope it's a bit clear, and you can give me a light
Thank you very much