diff --git a/Dapper/SqlMapper.cs b/Dapper/SqlMapper.cs index dbbb42557f0077bb05faed01fc536c47e61f607f..a48a460f2629a00335084970760696976e4f2215 100644 --- a/Dapper/SqlMapper.cs +++ b/Dapper/SqlMapper.cs @@ -431,9 +431,12 @@ public static IEnumerable Query(this IDbConnection cnn, string sql, object } // nice and simple - identity = new Identity(sql, commandType, cnn, null, (object)param == null ? null : ((object)param).GetType(), null); - info = GetCacheInfo(identity); - return ExecuteCommand(cnn, transaction, sql, info.ParamReader, (object)param, commandTimeout, commandType); + if ((object)param != null) + { + identity = new Identity(sql, commandType, cnn, null, (object) param == null ? null : ((object) param).GetType(), null); + info = GetCacheInfo(identity); + } + return ExecuteCommand(cnn, transaction, sql, (object)param == null ? null : info.ParamReader, (object)param, commandTimeout, commandType); } #if !CSHARP30 ///