正在处理已经构建的应用程序代码,现在可以使用Entity framework(oracle)在相似的行上工作。更改以下代码时遇到的问题
// Already Written Code
private static IEnumerable<IEnumerable<T>> ExecuteReader1(
IDbCommand command, List<IMapper<T>> mappers)
{
var listOfList = new List<IEnumerable<T>>();
//Here i have written code to fetch the data using LINQ (Entity Framework with Oracle)
using (var reader = command.ExecuteReader(CommandBehavior.CloseConnection))
{
foreach (var mapper in mappers)
{
List<T> list;
ReadResultset(reader, mapper, out list);
listOfList.Add(list);
if (!reader.NextResult())
break;
}
}
return listOfList;
}
private static void ReadResultset(IDataReader reader, IMapper<T> mapper, out List<T> list)
{
list = new List<T>();
while (reader.Read())
{
var item = new T();
mapper.Map(reader, item);
list.Add(item);
}
}
问题:如何更改上面的代码,因为现在结果将在Linq中。请告诉最佳做法