Commit bc481b6f authored by Jeremy Meng's avatar Jeremy Meng

Revert the HashTable => Dictionary<> change.

parent 5e68d069
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace StackExchange.Redis namespace StackExchange.Redis
...@@ -40,7 +39,7 @@ public sealed class LuaScript ...@@ -40,7 +39,7 @@ public sealed class LuaScript
bool HasArguments { get { return Arguments != null && Arguments.Length > 0; } } bool HasArguments { get { return Arguments != null && Arguments.Length > 0; } }
Dictionary<Type, Func<object, RedisKey?, ScriptParameterMapper.ScriptParameters>> ParameterMappers; Hashtable ParameterMappers;
internal LuaScript(string originalScript, string executableScript, string[] arguments) internal LuaScript(string originalScript, string executableScript, string[] arguments)
{ {
...@@ -50,7 +49,7 @@ internal LuaScript(string originalScript, string executableScript, string[] argu ...@@ -50,7 +49,7 @@ internal LuaScript(string originalScript, string executableScript, string[] argu
if (HasArguments) if (HasArguments)
{ {
ParameterMappers = new Dictionary<Type, Func<object, RedisKey?, ScriptParameterMapper.ScriptParameters>>(); ParameterMappers = new Hashtable();
} }
} }
...@@ -110,17 +109,17 @@ internal void ExtractParameters(object ps, RedisKey? keyPrefix, out RedisKey[] k ...@@ -110,17 +109,17 @@ internal void ExtractParameters(object ps, RedisKey? keyPrefix, out RedisKey[] k
if (ps == null) throw new ArgumentNullException("ps", "Script requires parameters"); if (ps == null) throw new ArgumentNullException("ps", "Script requires parameters");
var psType = ps.GetType(); var psType = ps.GetType();
var mapper = ParameterMappers[psType]; var mapper = (Func<object, RedisKey?, ScriptParameterMapper.ScriptParameters>)ParameterMappers[psType];
if (ps != null && mapper == null) if (ps != null && mapper == null)
{ {
lock (ParameterMappers) lock (ParameterMappers)
{ {
mapper = ParameterMappers[psType]; mapper = (Func<object, RedisKey?, ScriptParameterMapper.ScriptParameters>)ParameterMappers[psType];
if (mapper == null) if (mapper == null)
{ {
string missingMember; string missingMember;
string badMemberType; string badMemberType;
if(!ScriptParameterMapper.IsValidParameterHash(psType, this, out missingMember, out badMemberType)) if (!ScriptParameterMapper.IsValidParameterHash(psType, this, out missingMember, out badMemberType))
{ {
if (missingMember != null) if (missingMember != null)
{ {
......
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