Ejemplo n.º 1
0
 public int SearchReferencesCount(string ticket, TransitReferenceQueryOptions options)
 {
     using (DBlog.Data.Hibernate.Session.OpenConnection(GetNewConnection()))
     {
         ISession session = DBlog.Data.Hibernate.Session.Current;
         CountQuery query = new CountQuery(session, typeof(DBlog.Data.Reference), "Reference");
         if (options != null)
         {
             options.Apply(query);
         }
         return query.Execute<int>();
     }
 }
Ejemplo n.º 2
0
        public List<TransitReference> SearchReferences(string ticket, TransitReferenceQueryOptions options)
        {
            using (DBlog.Data.Hibernate.Session.OpenConnection(GetNewConnection()))
            {
                ISession session = DBlog.Data.Hibernate.Session.Current;

                ICriteria cr = session.CreateCriteria(typeof(Reference));

                if (options != null)
                {
                    options.Apply(cr);
                }

                IList<Reference> list = cr.List<Reference>();

                List<TransitReference> result = new List<TransitReference>(list.Count);

                foreach (Reference obj in list)
                {
                    result.Add(new TransitReference(obj));
                }

                return result;
            }
        }