2
Hello,
I have the following situation. A CRUD form calling another form (common or generic) to search for records...
private void barButtonItemProcurar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
FrmProcura<IMarcaService> frmProcura = new FrmProcura<IMarcaService>(_marcaService);
frmProcura.ShowDialog();
}
public partial class FrmProcura<T> : Form
{
private T _service;
public FrmProcura(T service)
{
_service = service;
InitializeComponent();
}
private void simpleButtonFechar_Click(object sender, EventArgs e)
{
this.Close();
}
private void simpleButtonProcurar_Click(object sender, EventArgs e)
{
//AQUI
var dados = _service.Procura("nome", textEditConteudo.Text);
gridControlDados.DataSource = dados;
gridControlDados.RefreshDataSource();
}
}
But in this way the methods (example of "search") of the service are not inherited (//HERE).
What is the best way to resolve this issue? I would also like to pass any model (empty) to the search window so that it returns populated with the record chosen in the search.
I couldn’t quite understand your problem... some mistake, where it just doesn’t work?
– Leandro Angelo
It just doesn’t work. Service methods are not exposed. :-(
– Roberson Afonso Naves
What do you mean they’re not exposed?
– Leandro Angelo
My services (brands, products, customers etc) have various methods (search, include, change, delete, pagination etc). The way it is, I can’t use them. [’T' does not contain a Definition for 'Search' and no accessible Extension method 'Search' Accepting a first argument of type’T' could be found]
– Roberson Afonso Naves
Please enter the code of your Imarcaservice interface and your parents if you hear. I think you can solve by implementing the search method definition in a Parent interface.
– Thiago Araújo