public int GetFeedItemsCount(string ticket, TransitFeedItemQueryOptions options) { using (DBlog.Data.Hibernate.Session.OpenConnection(GetNewConnection())) { ISession session = DBlog.Data.Hibernate.Session.Current; CountQuery q = new CountQuery(session, typeof(DBlog.Data.FeedItem), "FeedItem"); if (options != null) { options.Apply(q); } return q.Execute<int>(); } }
public List<TransitFeedItem> GetFeedItems(string ticket, TransitFeedItemQueryOptions options) { using (DBlog.Data.Hibernate.Session.OpenConnection(GetNewConnection())) { ISession session = DBlog.Data.Hibernate.Session.Current; ICriteria cr = session.CreateCriteria(typeof(FeedItem)); if (options != null) { options.Apply(cr); } IList<FeedItem> list = cr.List<FeedItem>(); List<TransitFeedItem> result = new List<TransitFeedItem>(list.Count); foreach (FeedItem obj in list) { result.Add(new TransitFeedItem(obj)); } return result; } }