From aaa3f60b182af4b508de697b9af34c7b9f9f3145 Mon Sep 17 00:00:00 2001 From: mgravell Date: Mon, 26 Sep 2011 06:42:43 +0100 Subject: [PATCH] patch applied for issue 66 --- Dapper/SqlMapper.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dapper/SqlMapper.cs b/Dapper/SqlMapper.cs index dbbb425..a48a460 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 /// -- GitLab