diff --git a/Dapper NET40/SqlMapper.cs b/Dapper NET40/SqlMapper.cs index f1b36ab1f..b40826ddf 100644 --- a/Dapper NET40/SqlMapper.cs +++ b/Dapper NET40/SqlMapper.cs @@ -2048,9 +2048,12 @@ private static CacheInfo GetCacheInfo(Identity identity, object exampleParameter { info.ParamReader = (cmd, obj) => { ((IDynamicParameters)obj).AddParameters(cmd, identity); }; } -#if !CSHARP30 - // special-case dictionary && `dynamic` - else if (exampleParameters is IEnumerable> && exampleParameters is System.Dynamic.IDynamicMetaObjectProvider) +#if CSHARP30 + else if (exampleParameters is IEnumerable>) +#else + // special-case dictionary and `dynamic` + else if (exampleParameters is IEnumerable> || exampleParameters is System.Dynamic.IDynamicMetaObjectProvider) +#endif { info.ParamReader = (cmd, obj) => { @@ -2058,7 +2061,6 @@ private static CacheInfo GetCacheInfo(Identity identity, object exampleParameter mapped.AddParameters(cmd, identity); }; } -#endif else { var literals = GetLiteralTokens(identity.sql); diff --git a/Tests/Tests.cs b/Tests/Tests.cs index ec6366fd9..d7763451f 100644 --- a/Tests/Tests.cs +++ b/Tests/Tests.cs @@ -3842,6 +3842,15 @@ public void SO25297173_DynamicIn() result.Contains(6).IsTrue(); } + public void AllowIDictionaryParameters() + { + var parameters = new Dictionary + { + { "param1", 0 } + }; + + connection.Query("SELECT @param1", parameters); + } #if POSTGRESQL class Cat