Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2004


Ignore:
Timestamp:
06/04/09 17:04:38 (15 years ago)
Author:
svonolfe
Message:

Added paging to DAL (#372)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/DataAdapterBase.cs

    r1580 r2004  
    138138    }
    139139
    140     protected ICollection<ObjT> FindMultiple(Selector selector) {
     140    private ICollection<ObjT> FindMultiple(Selector selector,
     141      int from, int size) {
    141142      ITransaction trans =
    142143       session.GetCurrentTransaction();
     
    150151          selector();
    151152
     153        if (from > 0 && size > 0)
     154          found = found.Skip<RowT>(from).Take<RowT>(size);
     155
    152156        IList<ObjT> result =
    153157          new List<ObjT>();
     
    167171        }
    168172      }     
     173    }
     174
     175    protected ICollection<ObjT> FindMultiple(Selector selector) {
     176      return FindMultiple(
     177        selector, 0, -1);
    169178    }
    170179
     
    244253    }
    245254
     255    public virtual ICollection<ObjT> GetAll(int from, int size) {
     256      //note - this base implementation is inefficient,
     257      //consider overriding the implementation
     258      //in derived adapters (based on a query (SQL LIMIT))
     259      return new List<ObjT>(
     260        FindMultiple(
     261          new Selector(dataAdapter.FindAll),
     262          from, size));
     263    }
     264
    246265    protected virtual bool doDelete(ObjT obj) {
    247266      bool success = false;
  • trunk/sources/HeuristicLab.DataAccess/3.2/Interfaces/IDataAdapter.cs

    r1493 r2004  
    4848
    4949    /// <summary>
     50    /// Get all objects (paged)
     51    /// </summary>
     52    /// <returns></returns>
     53    ICollection<ObjT> GetAll(int from, int size);
     54
     55    /// <summary>
    5056    /// Deletes the object
    5157    /// </summary>
Note: See TracChangeset for help on using the changeset viewer.