Commit d2cce62d authored by Matt Wilkinson's avatar Matt Wilkinson

Fixes StackExchange/dapper-dot-net#152

Allows use of IDictionary<string, object> as parameter objects.
I'm assuming that the && was a mistake, and that this logic should
handle both of the types equally well.
Also allows .NET 3.5 to use the IDictionary case.
parent 5f1a30e9
......@@ -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<KeyValuePair<string, object>> && exampleParameters is System.Dynamic.IDynamicMetaObjectProvider)
#if CSHARP30
else if (exampleParameters is IEnumerable<KeyValuePair<string, object>>)
#else
// special-case dictionary and `dynamic`
else if (exampleParameters is IEnumerable<KeyValuePair<string, object>> || 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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment