Commit 83b47e31 authored by Nick Craver's avatar Nick Craver

Merge pull request #308 from NikolayGlynchak/master

Added the GridReader.Read method with Type [] types and …
parents 1fb6694f fad35799
......@@ -4337,6 +4337,22 @@ private IEnumerable<T> ReadImpl<T>(Type type, bool buffered)
}
}
private IEnumerable<TReturn> MultiReadInternal<TReturn>(Type[] types, Func<object[], TReturn> map, string splitOn)
{
var identity = this.identity.ForGrid(typeof(TReturn), types, gridIndex);
try
{
foreach (var r in SqlMapper.MultiMapImpl<TReturn>(null, default(CommandDefinition), types, map, splitOn, reader, identity, false))
{
yield return r;
}
}
finally
{
NextResult();
}
}
#if CSHARP30
/// <summary>
/// Read multiple objects from a single record set on the grid
......@@ -4431,6 +4447,16 @@ private IEnumerable<T> ReadImpl<T>(Type type, bool buffered)
var result = MultiReadInternal<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TReturn>(func, splitOn);
return buffered ? result.ToList() : result;
}
/// <summary>
/// Read multiple objects from a single record set on the grid
/// </summary>
public IEnumerable<TReturn> Read<TReturn>(Type[] types, Func<object [], TReturn> map, string splitOn = "id", bool buffered = true)
{
var result = MultiReadInternal<TReturn>(types, map, splitOn);
return buffered ? result.ToList() : result;
}
#endif
private IEnumerable<T> ReadDeferred<T>(int index, Func<IDataReader, object> deserializer, Identity typedIdentity)
......
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