Wondering if someone can help me with NHibernate

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • moorcroft
    New Member
    • Mar 2008
    • 57

    Wondering if someone can help me with NHibernate

    Hi I'm looking for help with getting the latest NHibernate to work with my .Net 3.5 VS 2008 project that I am migrating from .Net 2.0 on VS 2005. Previously (VS 2005 .Net 2.0) I would use the folling lines to query the database:

    Code:
    ICriteria criteria = mSession.CreateCriteria(typeof(Application));
    criteria.Add(new EqExpression("ReferenceNumber", "2008/0128/NEW", true));
    BCApplication application = (Application)criteria.UniqueResult();
    This does not work in .Net 3.5 as I cannot seem to find EqExpression. In .Net 2.0 version of Nhibernate it is contained within NHibernate.Expr ession.EqExpres sion however .Net 3.5 version of NHibernate does not have the Expression class.

    I'm having a nightmare googling this, so can someone please help me!!
  • moorcroft
    New Member
    • Mar 2008
    • 57

    #2
    OK forget about this actually I've worked out that it should now be:

    Code:
    criteria.Add(Restrictions.Eq("ApplicationNumber", referenceNumber));

    Comment

    Working...