I am trying out Dapper and I have stumbled upon this exception:
System.InvalidOperationException: The ConnectionString property has not been initialized.
...
Here is the code:
public IEnumerable<T> GetAll<T>(string sql, DynamicParameters parameters, string connectionString, CommandType commandType = CommandType.StoredProcedure)
{
using IDbConnection db = new SqlConnection(connectionString);
var result = db.Query<T>(sql, parameters, commandType: commandType, commandTimeout: COMMAND_TIMEOUT, buffered: false);
return result;
}
When I remove the buffered
parameter, everything works OK.
var result = db.Query<T>(sql, parameters, commandType: commandType, commandTimeout: COMMAND_TIMEOUT);