I need to pass a sql query to c#.
Here is the query:
select
T010.A010_nom_ent A010_nom_ent
from
T010_ENTIDADE T010,
T016_USUARIO T016
left outer join
T307_CELULA_USUARIO T307 ON T307.A306_seq_celula = 0
and T307.A016_cod_usuario = T016.A016_cod_usuario
where
T010.A010_cod_entidade = T016.A016_cod_usuario
order by 1
and the code is here:
public List<Entidade> ListarUsuariosCelula()
{
List<Entidade> lstEntidades = null;
try
{
oInvitroEntities = new InvitroEntities();
lstEntidades = (***here is where i want to put the query***)
return lstEntidades;
}
catch (Exception ex)
{
LogErro.Trace(ex);
throw ex;
}
finally
{
oInvitroEntities = null;
}
}
Here is one exemple of what i want to do (i will put just a piece of the code):
try
{
oInvitroEntities = new InvitroEntities();
lstCelula = (from cel in oInvitroEntities.T306_CELULA
select new Celula { Codigo = cel.A306_seq_celula, Descricao = cel.A306_dsc_celula }).ToList();
return lstCelula;
}