Hi,
I'm having an issue with SqlModelMapper when I'm trying to Load with a modified SqlQueryBuilder. If I call SqlExecutor.Select with the SqlQueryBuilder it works ok, but if I call SqlModelMapper.Load with the same SqlQueryBuilder, it seems to ignore it and just use it's original query.
I want to use SqlModelMapper to take advantage of the nested model feature, otherwise I would just use SqlExecutor.
Originally I noticed the issue with some complex sql and model, but I can reproduce it with a simple model and sql. My function is below (I just uncomment the relevant return line to test both cases). Can anyone see any issues with my code?
public IList<codeDetails> Retrieve()
{
ISqlQueryBuilder queryBuilder =
ModelSqlBuilder.GetBuilder<codeDetails>(_dataContext).QueryBuilder;
queryBuilder.AsWhere().AndWhereRaw("code_details.table_id = 'PN'");
string sql = queryBuilder.ToSqlString(_dataContext);
Console.WriteLine(sql);
// This line works as expected
//return _dataContext.SqlExecutor.Select<codeDetails>(queryBuilder).ToList();
// This line ignores the modified queryBuilder
return _dataContext.SqlModelMapper.Load<codeDetails>(queryBuilder).ToList();
}