NHibernate 根据Model ID获取对象
public virtual DemissionRemittanceInfo GetDemissionRemittanceInfo(int demissionremittanceID) { using (ISession session = OpenSession()) { return (DemissionRemittanceInfo)NHibernateHelper.GetObject(session, typeof(DemissionRemittanceInfo), demissionremittanceID); } }
public virtual DemissionRemittanceInfo GetDemissionRemittanceInfoByDemissionID(int demissionID) { using (ISession session = OpenSession()) { ArrayList list = (ArrayList)session.CreateCriteria(typeof(DemissionRemittanceInfo)).Add(Expression.Eq("DemissionID", demissionID)).List(); if (list.Count > 0) return (DemissionRemittanceInfo)list[0]; return null; } }