Skip to content
Apr 7 2007

NHibernateRepository Upgraded for NHibernate 1.2 RC1

Now that NHibernate 1.2 is finally out of Beta stage and into official Release Candidate mode, I felt it was appropriate to upgrade NHibernateRepository to use it. Not much has changed and there isn’t any new functionality, but I wrote some tests for it and of course updated its references to NHibernate 1.2 RC1.

You can get the latest NHibernateRepository here.

Similar Posts:

  • andrey

    Simple question here, why in Repository you not used System.Collections.Generic.List<T>?

    You use:
    public static Collection<T> Find<T>(string hql)
    {
    using (Repository rep = new Repository())
    {
    //IList list = rep.Session.Find(hql); // Deprecated with NHibernate 1.2
    IList list = rep.Session.CreateQuery(hql).List();
    return ToGenericCollection<T>(list);
    }
    }

    private static Collection<T> ToGenericCollection<T>(IList list)
    {
    Collection<T> coll = new Collection<T>();

    if (list != null && list.Count > 0)
    {
    foreach (T t in list)
    {
    coll.Add(t);
    }
    }

    return coll;
    }

    Why not,

    public static List<T> Find<T>(string hql)
    {
    using (Repository rep = new Repository())
    {
    //IList list = rep.Session.Find(hql); // Deprecated with NHibernate 1.2
    IList<T> list = rep.Session.CreateQuery(hql).List<T>();
    return list;
    }
    }
    ?