コード例 #1
0
 public static IList Find(string query, ICollection paramInfos, PagerInfo pi)
 {
     ISession s = Sessions.GetSession();
     try
     {
         IQuery q = s.CreateQuery( query );
         if ( paramInfos != null )
         {
             foreach (ParamInfo info in paramInfos)
             {
                 if (info.Value is ICollection)
                     q.SetParameterList(info.Name, (ICollection)info.Value, info.Type);
                 else
                     q.SetParameter(info.Name, info.Value, info.Type);
             }
         }
         if (pi != null )
         {
             q.SetFirstResult( pi.FirstResult );
             q.SetMaxResults( pi.MaxResults );
         }
         return q.List();
     }
     finally
     {
         s.Close();
     }
 }
コード例 #2
0
 public static IList Find(ICriterion crit, Type type, PagerInfo pi)
 {
     ISession s = Sessions.GetSession();
     try
     {
         ICriteria c = s.CreateCriteria(type);
         if (crit != null ) c.Add(crit);
         if (pi != null )
         {
             c.SetFirstResult(pi.FirstResult);
             c.SetMaxResults(pi.MaxResults);
         }
         return c.List();
     }
     finally
     {
         s.Close();
     }
 }