public void GetWholeNumberDictionaryParams() { bool bit = true; bool?bitNull = null; bool?bitNullable = false; byte tinyInt = byte.MaxValue; byte?tinyIntNull = null; byte?tinyIntNullable = byte.MinValue; short smallInt = short.MaxValue; short?smallIntNull = null; short?smallIntNullable = short.MinValue; int int_ = int.MaxValue; int?intNull = null; int?intNullable = int.MinValue; long bigInt = long.MaxValue; long?bigIntNull = null; long?bigIntNullable = long.MinValue; var paramDict = new Dictionary <string, object> { { "Bit", bit }, { "BitNull", bitNull }, { "BitNullable", bitNullable }, { "TinyInt", tinyInt }, { "TinyIntNull", tinyIntNull }, { "TinyIntNullable", tinyIntNullable }, { "SmallInt", smallInt }, { "SmallIntNull", smallIntNull }, { "SmallIntNullable", smallIntNullable }, { "Int", int_ }, { "IntNull", intNull }, { "IntNullable", intNullable }, { "BigInt", bigInt }, { "BigIntNull", bigIntNull }, { "BigIntNullable", bigIntNullable } }; dynamic paramDynamic = new { Bit = bit, BitNull = bitNull, BitNullable = bitNullable, TinyInt = tinyInt, TinyIntNull = tinyIntNull, TinyIntNullable = tinyIntNullable, SmallInt = smallInt, SmallIntNull = smallIntNull, SmallIntNullable = smallIntNullable, Int = int_, IntNull = intNull, IntNullable = intNullable, BigInt = bigInt, BigIntNull = bigIntNull, BigIntNullable = bigIntNullable }; var sw = new Stopwatch(); for (int j = 0; j < 5; j++) { sw.Restart(); _repository.RunCommand(cmd => { cmd.UseProcedure("dbo.GetWholeNumberParams"); if (j < 3) { cmd.AddParams(paramDict); } else { _repository.AddParams(cmd, paramDynamic); } cmd.ExecuteReader(reader => { var i = 0; reader.Read(r => { Assert.AreEqual(r.GetBoolean(i++), paramDict["Bit"], "bit"); Assert.AreEqual(r.GetBooleanNullable(i++), paramDict["BitNull"], "bitNull"); Assert.AreEqual(r.GetBooleanNullable(i++), paramDict["BitNullable"], "bitNullable"); Assert.AreEqual(r.GetByte(i++), paramDict["TinyInt"], "tinyInt"); Assert.AreEqual(r.GetByteNullable(i++), paramDict["TinyIntNull"], "tinyIntNull"); Assert.AreEqual(r.GetByteNullable(i++), paramDict["TinyIntNullable"], "tinyIntNullable"); Assert.AreEqual(r.GetInt16(i++), paramDict["SmallInt"], "smallInt"); Assert.AreEqual(r.GetInt16Nullable(i++), paramDict["SmallIntNull"], "smallIntNull"); Assert.AreEqual(r.GetInt16Nullable(i++), paramDict["SmallIntNullable"], "smallIntNullable"); Assert.AreEqual(r.GetInt32(i++), paramDict["Int"], "int_"); Assert.AreEqual(r.GetInt32Nullable(i++), paramDict["IntNull"], "intNull"); Assert.AreEqual(r.GetInt32Nullable(i++), paramDict["IntNullable"], "intNullable"); Assert.AreEqual(r.GetInt64(i++), paramDict["BigInt"], "bigInt"); Assert.AreEqual(r.GetInt64Nullable(i++), paramDict["BigIntNull"], "bigIntNull"); Assert.AreEqual(r.GetInt64Nullable(i++), paramDict["BigIntNullable"], "bigIntNullable"); }); }); }); sw.Stop(); Console.WriteLine($"dbo.GetWholeNumberParams execution # {j + 1} took {sw.Elapsed.TotalMilliseconds.ToString("0.##")} ms"); } }