From bcab7d7b108591692d0e0c690e352a112823f1c1 Mon Sep 17 00:00:00 2001 From: "simon.cropp" Date: Wed, 11 May 2011 21:15:47 +1000 Subject: [PATCH] remove some unused code --- Dapper/SqlMapper.cs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Dapper/SqlMapper.cs b/Dapper/SqlMapper.cs index 4f9c18d..d330549 100644 --- a/Dapper/SqlMapper.cs +++ b/Dapper/SqlMapper.cs @@ -197,7 +197,7 @@ private static IEnumerable QueryInternal(this IDbConnection cnn, string sq { if (info.Deserializer == null) { - info.Deserializer = GetDeserializer(identity, reader); + info.Deserializer = GetDeserializer(reader); queryCache[identity] = info; } @@ -284,30 +284,30 @@ class DontMap {} var otherDeserializer = new List(); split = nextSplit(); - info.Deserializer = GetDeserializer(identity, reader, 0, split); + info.Deserializer = GetDeserializer(reader, 0, split); if (typeof(TSecond) != typeof(DontMap)) { var next = nextSplit(); - otherDeserializer.Add(GetDeserializer(identity, reader, split, next - split, returnNullIfFirstMissing: true)); + otherDeserializer.Add(GetDeserializer(reader, split, next - split, returnNullIfFirstMissing: true)); split = next; } if (typeof(TThird) != typeof(DontMap)) { var next = nextSplit(); - otherDeserializer.Add(GetDeserializer(identity, reader, split, next - split, returnNullIfFirstMissing: true)); + otherDeserializer.Add(GetDeserializer(reader, split, next - split, returnNullIfFirstMissing: true)); split = next; } if (typeof(TFourth) != typeof(DontMap)) { var next = nextSplit(); - otherDeserializer.Add(GetDeserializer(identity, reader, split, next - split, returnNullIfFirstMissing: true)); + otherDeserializer.Add(GetDeserializer(reader, split, next - split, returnNullIfFirstMissing: true)); split = next; } if (typeof(TFifth) != typeof(DontMap)) { var next = nextSplit(); - otherDeserializer.Add(GetDeserializer(identity, reader, split, next - split, returnNullIfFirstMissing: true)); + otherDeserializer.Add(GetDeserializer(reader, split, next - split, returnNullIfFirstMissing: true)); } info.OtherDeserializers = otherDeserializer.ToArray(); @@ -373,7 +373,7 @@ private static CacheInfo GetCacheInfo(object param, Identity identity) return info; } - private static Func GetDeserializer(Identity identity, IDataReader reader, int startBound = 0, int length = -1, bool returnNullIfFirstMissing = false) + private static Func GetDeserializer(IDataReader reader, int startBound = 0, int length = -1, bool returnNullIfFirstMissing = false) { // dynamic is passed in as Object ... by c# design if (typeof (T) == typeof (object) || typeof (T) == typeof (FastExpando)) @@ -384,7 +384,7 @@ private static CacheInfo GetCacheInfo(object param, Identity identity) { return GetClassDeserializer(reader, startBound, length, returnNullIfFirstMissing); } - return GetStructDeserializer(reader); + return GetStructDeserializer(); } @@ -631,7 +631,7 @@ private static int ExecuteCommand(IDbConnection cnn, IDbTransaction tranaction, } } - private static Func GetStructDeserializer(IDataReader reader) + private static Func GetStructDeserializer() { return r => { @@ -691,7 +691,7 @@ private static int ExecuteCommand(IDbConnection cnn, IDbTransaction tranaction, int index = startBound; - var @try = il.BeginExceptionBlock(); + il.BeginExceptionBlock(); // stack is empty il.Emit(OpCodes.Newobj, typeof(T).GetConstructor(Type.EmptyTypes)); // stack is now [target] bool first = true; @@ -827,8 +827,7 @@ public IEnumerable Read() { if (reader == null) throw new ObjectDisposedException(GetType().Name); if (consumed) throw new InvalidOperationException("Each grid can only be iterated once"); - var identity = new Identity(sql, connection, typeof(T), null); - var deserializer = SqlMapper.GetDeserializer(identity, reader); + var deserializer = GetDeserializer(reader); consumed = true; return ReadDeferred(gridIndex, deserializer); } -- GitLab