0
I have this typing error when trying to map a Sqldatareader coming from a previous, mapping with Automapper
Error
An unhandled Exception of type 'Automapper.Automappermappingexception' occurred in Automapper.dll
Additional information: Error Mapping types
Follow my Datareader
public List<T> DataReader<T>(string Procedure, List<SqlParameter> parameters)
{
var rows = ExecuteProcedureReader(Procedure, parameters);
if (rows.HasRows)
{
var config = new MapperConfiguration(cfg => { });
var mapper = config.CreateMapper();
return mapper.Map<IDataReader, List<T>>(rows);
}
return null;
}
My Class
public class Usuario
{
public int Codigo { get; set; }
public string Nome { get; set; }
public string Emdereco { get; set; }
public string Cpf { get; set; }
}
Call of my method
var lista = conn.DataReader<Usuario>("PR_USUARIO_CONSULTAR", param);
foreach (var item in lista)
{
Console.WriteLine(item.Nome);
}
Where is and how Automapper is being booted?
– Marcelo Shiniti Uchimura