public virtual T GetByParameters(Tpmt parameters) { DetachedNamedQuery dnq = this.GetDetachedNamedQuery( typeof(T).Name + ".GetByParameters", parameters); return(dnq.GetExecutableQuery(Session).UniqueResult <T>()); }
public virtual DateTime GetServerDateTime() { DetachedNamedQuery dnq = new DetachedNamedQuery("BaseReadOnlyDao.GetServerDateTime"); DateTime result = dnq.GetExecutableQuery(Session).UniqueResult <DateTime>(); return(result); }
public void ResultTransformer() { IDetachedQuery dq = new DetachedNamedQuery("NoFoo.SQL.Parameters"); dq.SetString("p1", "%1_") .SetResultTransformer(new AliasToBeanResultTransformer(typeof(NoFoo))); using (ISession s = OpenSession()) { IQuery q = dq.GetExecutableQuery(s); IList <NoFoo> l = q.List <NoFoo>(); Assert.AreEqual(5, l.Count); } }
public void ExecutableNamedQuery() { IDetachedQuery dq = new DetachedNamedQuery("Foo.WithParameters"); dq.SetString("pn", "N2"); using (ISession s = OpenSession()) { IQuery q = dq.GetExecutableQuery(s); IList <Foo> l = q.List <Foo>(); Assert.AreEqual(1, l.Count); Assert.AreEqual("N2", l[0].Name); Assert.AreEqual("D2", l[0].Description); } // reusing same IDetachedQuery dq.SetString("pn", "@All@"); using (ISession s = OpenSession()) { IQuery q = dq.GetExecutableQuery(s); IList l = q.List(); Assert.AreEqual(totalFoo, l.Count); } }
private SqlFileStream GetSqlFileStream(int tenderFileId, ISession session, FileAccess fileAccess) { TenderFileParameters pmtTenderFile = new TenderFileParameters(); pmtTenderFile.TenderFileId = tenderFileId; DetachedNamedQuery dnq = this.GetDetachedNamedQuery("GetTenderFileStreamContext", pmtTenderFile); Object[] objTenderFileStreamContext = dnq.GetExecutableQuery(session).UniqueResult() as Object[]; string filePath = objTenderFileStreamContext[0] as string; byte[] txContext = objTenderFileStreamContext[1] as Byte[]; return(new SqlFileStream(filePath, txContext, fileAccess)); }
private IList GetGenericList(DetachedNamedQuery dnq) { return(dnq.GetExecutableQuery(Session).List()); }
private IList <T> GetList(DetachedNamedQuery dnq) { return(dnq.GetExecutableQuery(Session).List <T>()); }
public IList GetObjectList(DetachedNamedQuery dnq) { return(dnq.GetExecutableQuery(Session).List()); }
public IList <TType> GetList <TType>(DetachedNamedQuery dnq) { return(dnq.GetExecutableQuery(Session).List <TType>()); }