0
Handling class with RU:
ContextEF Contexto = new ContextEF();
public List<Cliente> Listar()
{
//var query = from c in Contexto.Cliente
// select c;
return Contexto.Cliente.ToList() ;
}
Onclick of the consultation page
protected void btnPesquisar_Click(object sender, EventArgs e)
{
ClientService service = new ClientService();
var lista = service.Listar();
gvListacEF.DataSource = lista;
gvListacEF.DataBind();
}
Error presented:
Error CS0012 The type 'Client' is defined in an Assembly that is not referenced. You must add a Reference to Assembly 'DAO, Version=1.0.0.0, Culture=neutral, Publickeytoken=null'
Have you renamed this class recently? This dll? Did you merge some where there was conflict of reference?
– Gabriel Coletta
I have not renamed either the class or the dll. .
– JB_
You referenced this Assembly (DAO) in the current Assembly?
– Gabriel Coletta
No. I’m trying to recreate the project to see what I might have done wrong.
– JB_
That’s the problem, you’re using that Assembly DAO but you haven’t added the reference in your current Assembly. Tell me if doing this works.
– Gabriel Coletta
Boy, it worked. Thank you very much. I didn’t know that detail, I’m learning Asp.net.
– JB_
Let’s go continue this discussion in chat.
– JB_