Commit bcab7d7b authored by simon.cropp's avatar simon.cropp

remove some unused code

parent 09f8759b
...@@ -197,7 +197,7 @@ private static IEnumerable<T> QueryInternal<T>(this IDbConnection cnn, string sq ...@@ -197,7 +197,7 @@ private static IEnumerable<T> QueryInternal<T>(this IDbConnection cnn, string sq
{ {
if (info.Deserializer == null) if (info.Deserializer == null)
{ {
info.Deserializer = GetDeserializer<T>(identity, reader); info.Deserializer = GetDeserializer<T>(reader);
queryCache[identity] = info; queryCache[identity] = info;
} }
...@@ -284,30 +284,30 @@ class DontMap {} ...@@ -284,30 +284,30 @@ class DontMap {}
var otherDeserializer = new List<object>(); var otherDeserializer = new List<object>();
split = nextSplit(); split = nextSplit();
info.Deserializer = GetDeserializer<TFirst>(identity, reader, 0, split); info.Deserializer = GetDeserializer<TFirst>(reader, 0, split);
if (typeof(TSecond) != typeof(DontMap)) if (typeof(TSecond) != typeof(DontMap))
{ {
var next = nextSplit(); var next = nextSplit();
otherDeserializer.Add(GetDeserializer<TSecond>(identity, reader, split, next - split, returnNullIfFirstMissing: true)); otherDeserializer.Add(GetDeserializer<TSecond>(reader, split, next - split, returnNullIfFirstMissing: true));
split = next; split = next;
} }
if (typeof(TThird) != typeof(DontMap)) if (typeof(TThird) != typeof(DontMap))
{ {
var next = nextSplit(); var next = nextSplit();
otherDeserializer.Add(GetDeserializer<TThird>(identity, reader, split, next - split, returnNullIfFirstMissing: true)); otherDeserializer.Add(GetDeserializer<TThird>(reader, split, next - split, returnNullIfFirstMissing: true));
split = next; split = next;
} }
if (typeof(TFourth) != typeof(DontMap)) if (typeof(TFourth) != typeof(DontMap))
{ {
var next = nextSplit(); var next = nextSplit();
otherDeserializer.Add(GetDeserializer<TFourth>(identity, reader, split, next - split, returnNullIfFirstMissing: true)); otherDeserializer.Add(GetDeserializer<TFourth>(reader, split, next - split, returnNullIfFirstMissing: true));
split = next; split = next;
} }
if (typeof(TFifth) != typeof(DontMap)) if (typeof(TFifth) != typeof(DontMap))
{ {
var next = nextSplit(); var next = nextSplit();
otherDeserializer.Add(GetDeserializer<TFifth>(identity, reader, split, next - split, returnNullIfFirstMissing: true)); otherDeserializer.Add(GetDeserializer<TFifth>(reader, split, next - split, returnNullIfFirstMissing: true));
} }
info.OtherDeserializers = otherDeserializer.ToArray(); info.OtherDeserializers = otherDeserializer.ToArray();
...@@ -373,7 +373,7 @@ private static CacheInfo GetCacheInfo(object param, Identity identity) ...@@ -373,7 +373,7 @@ private static CacheInfo GetCacheInfo(object param, Identity identity)
return info; return info;
} }
private static Func<IDataReader, T> GetDeserializer<T>(Identity identity, IDataReader reader, int startBound = 0, int length = -1, bool returnNullIfFirstMissing = false) private static Func<IDataReader, T> GetDeserializer<T>(IDataReader reader, int startBound = 0, int length = -1, bool returnNullIfFirstMissing = false)
{ {
// dynamic is passed in as Object ... by c# design // dynamic is passed in as Object ... by c# design
if (typeof (T) == typeof (object) || typeof (T) == typeof (FastExpando)) if (typeof (T) == typeof (object) || typeof (T) == typeof (FastExpando))
...@@ -384,7 +384,7 @@ private static CacheInfo GetCacheInfo(object param, Identity identity) ...@@ -384,7 +384,7 @@ private static CacheInfo GetCacheInfo(object param, Identity identity)
{ {
return GetClassDeserializer<T>(reader, startBound, length, returnNullIfFirstMissing); return GetClassDeserializer<T>(reader, startBound, length, returnNullIfFirstMissing);
} }
return GetStructDeserializer<T>(reader); return GetStructDeserializer<T>();
} }
...@@ -631,7 +631,7 @@ private static int ExecuteCommand(IDbConnection cnn, IDbTransaction tranaction, ...@@ -631,7 +631,7 @@ private static int ExecuteCommand(IDbConnection cnn, IDbTransaction tranaction,
} }
} }
private static Func<IDataReader, T> GetStructDeserializer<T>(IDataReader reader) private static Func<IDataReader, T> GetStructDeserializer<T>()
{ {
return r => return r =>
{ {
...@@ -691,7 +691,7 @@ private static int ExecuteCommand(IDbConnection cnn, IDbTransaction tranaction, ...@@ -691,7 +691,7 @@ private static int ExecuteCommand(IDbConnection cnn, IDbTransaction tranaction,
int index = startBound; int index = startBound;
var @try = il.BeginExceptionBlock(); il.BeginExceptionBlock();
// stack is empty // stack is empty
il.Emit(OpCodes.Newobj, typeof(T).GetConstructor(Type.EmptyTypes)); // stack is now [target] il.Emit(OpCodes.Newobj, typeof(T).GetConstructor(Type.EmptyTypes)); // stack is now [target]
bool first = true; bool first = true;
...@@ -827,8 +827,7 @@ public IEnumerable<T> Read<T>() ...@@ -827,8 +827,7 @@ public IEnumerable<T> Read<T>()
{ {
if (reader == null) throw new ObjectDisposedException(GetType().Name); if (reader == null) throw new ObjectDisposedException(GetType().Name);
if (consumed) throw new InvalidOperationException("Each grid can only be iterated once"); if (consumed) throw new InvalidOperationException("Each grid can only be iterated once");
var identity = new Identity(sql, connection, typeof(T), null); var deserializer = GetDeserializer<T>(reader);
var deserializer = SqlMapper.GetDeserializer<T>(identity, reader);
consumed = true; consumed = true;
return ReadDeferred(gridIndex, deserializer); return ReadDeferred(gridIndex, deserializer);
} }
......
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