Rather than do a String.Format, ActiveRecord has a Query.SetParameterList(“Param”, IList) method that can be used for IN statements. Doing it this way allows for query caching, as well as simpler code. In the following example, lstKeys is a List object.

string hql = String.Format("FROM MyObject o WHERE o.Pk.Key in (:keys) ORDER BY o.SomeColumn");

SimpleQuery<MyObject> q = new SimpleQuery<MyObject>(hql);
q.SetParameterList("keys", lstKeys);
q.SetQueryRange(25);
MyObject[] result = q.Execute();