我需要我的 sql 查询,其中包含应用于日志 porpose 的参数。
private dynamic GetInfo(int cdEmpresa)
{
dynamic info = new ExpandoObject();
StringBuilder sql = new StringBuilder();
sql.AppendLine(" SELECT * from FROM EMPRESA E");
sql.AppendLine(" WHERE cdEmpresa = @cdEmpresa ");
using (IDbConnection cn = GetConnection(cdEmpresa).Connection)
{
Logger.Debug("SQL: " + sql.ToString()); // Does not apply the parameters, obviously
cn.Open();
info = cn.Query<dynamic>(sql.ToString(), new
{
cdEmpresa = cdEmpresa // i need to execute te sql to parametrize it, is there a way to parametrize it first its execution?
}).ToList();
}
return infoCadastro;
}