Exemplo n.º 1
0
 public IEnumerable <object> ToEnumerable(RequestContext context, IDataReaderWrapper dataReader, Type targetType, bool isDispose = true)
 {
     try
     {
         IList <object> list = new List <object>();
         if (dataReader.Read())
         {
             var rowParser = dataReader.GetRowParser(targetType);
             do
             {
                 var target = rowParser(dataReader);
                 list.Add(target);
             } while (dataReader.Read());
         }
         return(list);
     }
     finally
     {
         Dispose(dataReader, isDispose);
     }
 }
Exemplo n.º 2
0
 public object ToSingle(RequestContext context, IDataReaderWrapper dataReader, Type targetType, bool isDispose = true)
 {
     try
     {
         dataReader.Read();
         var rowParser = dataReader.GetRowParser(targetType);
         return(rowParser(dataReader));
     }
     finally
     {
         Dispose(dataReader, isDispose);
     }
 }
Exemplo n.º 3
0
 public IEnumerable <T> ToEnumerable <T>(RequestContext context, IDataReaderWrapper dataReader, bool isDispose = true)
 {
     try
     {
         IList <T> list       = new List <T>();
         var       targetType = typeof(T);
         if (dataReader.Read())
         {
             var deser = _dataRowParserFactory.GetParser(dataReader, context, targetType);
             do
             {
                 T target = (T)deser(dataReader, context);
                 list.Add(target);
             } while (dataReader.Read());
         }
         return(list);
     }
     finally
     {
         Dispose(dataReader, isDispose);
     }
 }
Exemplo n.º 4
0
 public object ToSingle(RequestContext context, IDataReaderWrapper dataReader, Type targetType, bool isDispose = true)
 {
     try
     {
         if (dataReader.Read())
         {
             var deser = _dataRowParserFactory.GetParser(dataReader, context, targetType);
             return(deser(dataReader, context));
         }
         return(null);
     }
     finally
     {
         Dispose(dataReader, isDispose);
     }
 }
Exemplo n.º 5
0
 public T ToSingle <T>(RequestContext context, IDataReaderWrapper dataReader, bool isDispose = true)
 {
     try
     {
         if (dataReader.Read())
         {
             var targetType = typeof(T);
             var rowParser  = dataReader.GetRowParser(targetType);
             return((T)rowParser(dataReader));
         }
         return(default(T));
     }
     finally
     {
         Dispose(dataReader, isDispose);
     }
 }
Exemplo n.º 6
0
 public T ToSingle <T>(RequestContext context, IDataReaderWrapper dataReader, bool isDispose = true)
 {
     try
     {
         var targetType = typeof(T);
         if (dataReader.Read())
         {
             var    deser  = _dataRowParserFactory.GetParser(dataReader, context, targetType);
             object target = deser(dataReader, context);
             return((T)target);
         }
         return(default(T));
     }
     finally
     {
         Dispose(dataReader, isDispose);
     }
 }