コード例 #1
0
ファイル: WebServices.Blog.cs プロジェクト: dblock/dblog
 public int GetImagesCount(string ticket, TransitImageQueryOptions options)
 {
     using (DBlog.Data.Hibernate.Session.OpenConnection(GetNewConnection()))
     {
         ISession session = DBlog.Data.Hibernate.Session.Current;
         CountQuery query = new CountQuery(session, typeof(DBlog.Data.Image), "Image");
         if (options != null) options.Apply(query);
         return query.Execute<int>();
     }
 }
コード例 #2
0
ファイル: WebServices.Blog.cs プロジェクト: dblock/dblog
        public List<TransitImage> GetImages(string ticket, TransitImageQueryOptions options)
        {
            using (DBlog.Data.Hibernate.Session.OpenConnection(GetNewConnection()))
            {
                ISession session = DBlog.Data.Hibernate.Session.Current;

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

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

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

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

                foreach (Image obj in list)
                {
                    result.Add(new TransitImage(session, obj, ticket));
                }

                return result;
            }
        }