Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 0.90 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.     public virtual List<CreditUnion> ExecuteF(Func<System.Data.IDataReader, CreditUnion> map)
  2.             {
  3.                 var command = _database.GetStoredProcCommand("GETALLA2A");//ENTLIB?
  4.                 _database.AddInParameter(command, "mode", System.Data.DbType.String, "M");
  5.      
  6.                 var list = new List<CreditUnion>();
  7.      
  8.                 using (var reader = _database.ExecuteReader(command))
  9.      
  10.                     //turn Read into a generator... e.i unfold
  11.                     // :) http://jrwren.wrenfam.com/blog/2008/12/26/functional-functions/
  12.                     // Read just isn't functional so we use "let" and TakeWhile.
  13.                     return
  14.                         SRTSolutions.Elevate.Seq.Unfold(reader, r => r.Read() ? Option.Some(r) : Option<System.Data.IDataReader>.None)
  15.                             .Select(r => map(r))
  16.                             .ToList();
  17.             }