22 Apr 2011 @ 10:24 PM 

This is a simple and straightforward method I put in my base repositories to retrieve the row count of the results from an nhibernate criteria query.

protected int GetResultsCount(ICriteria criteria)
        {
            criteria.SetProjection(Projections.RowCount());
            var eventsCount = criteria.UniqueResult<int>();
            return eventsCount;
        }
Posted By: Boyd
Last Edit: 14 Apr 2011 @ 10:27 PM

EmailPermalinkComments Off
Tags
Tags: , ,
Categories: .Net, Programming

 Last 50 Posts
Change Theme...
  • Users » 3
  • Posts/Pages » 30
  • Comments » 0
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

GeekPub



    No Child Pages.