I am trying to pass a parameter that is a list of integers, this should be appended to query in the IN clause of the sql server, but I'm not sure how to use it with DAPPER .
I tried to do it this way.
var adesao = Adesao.Repositorio.Obter(adesaoId.Value);
if (adesao != null)
{
adesoes = string.Join(",", Adesao.Repositorio.ObterTodasAdesoes(adesao));
var ids = new[] { adesoes.Split(',').Select(Int32.Parse).ToList() };
adesoesids = new { ids };
sb.AppendWhere(" e.AdesaoId IN (@adesoes) ");
}
// Assembly of the parameters;
var parametros = new
{
adesoes = adesoesids,
};
return SessionDapper.Query<Extrato>(sb.ToString(), parametros).ToList();
If I pass the string direct adhesions until it arrives the way it should only of the type string where it should be integers as (1,2,3,4 ...) is going ('1,2,3,4. .)
adesoes = string.Join(",", Adesao.Repositorio.ObterTodasAdesoes(adesao));