I am working on a windows forms app, in which I work with EF, ninject. With ninject injecto Interface and class.
Bind(typeof(ISaProveedor)).To(typeof(SaProveedor));
My problem is not that, I am illustrating how my app works
The problem comes here, usually I urge it in the constructor in the following way.
private ISaProveedor _repositoryProveedor;
public frmBusqueda(ISaProveedor repositoryProveedor)
{
_repositoryProveedor = repositoryProveedor;
InitializeComponent();
}
That way I have never had problems, the problem originates when I overload the constructor and explicitly call that constructor in specific.
private ISaProveedor _repositoryProveedor;
public frmBusqueda(ISaProveedor repositoryProveedor) : this()
{
_repositoryProveedor = repositoryProveedor;
InitializeComponent();
}
public frmBusqueda(string title, AsignacionTablas t)
{
Titulo = title;
Table = t;
}
This is the problem I call this last constructor and I can no longer instantiate the variables that are in the constructor above, which are the variables that I use to use my methods that are in my SaProveedor class, for which it gives me error when I call the methods like in this case.
private void BuscarInformacion(AsignacionTablas t)
{
switch (t)
{
case AsignacionTablas.Proveedor:
DGVBusquedaDto filter = new DGVBusquedaDto()
{
Descripcion = Helper.InputBoxValor
};
**listDGV = _repositoryProveedor.SelectList(filter.Descripcion);**
dgvBusqueda.DataSource = listDGV;
break;
case AsignacionTablas.Producto:
break;
case AsignacionTablas.Categoria:
break;
case AsignacionTablas.SubCategoria:
break;
default:
break;
}
}
Where it says _repositoryProvider, the error message is not instantiated and it is logical because at no time I do it, thanks to the second constructor that I explicitly call, when I say second constructor I refer to the one that carries the tille parameters, AshibitionTablas.
I hope you can support me.