예제 #1
0
        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);
            }
        }
예제 #5
0
        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));
        }
예제 #6
0
 private IList GetGenericList(DetachedNamedQuery dnq)
 {
     return(dnq.GetExecutableQuery(Session).List());
 }
예제 #7
0
 private IList <T> GetList(DetachedNamedQuery dnq)
 {
     return(dnq.GetExecutableQuery(Session).List <T>());
 }
예제 #8
0
 public IList GetObjectList(DetachedNamedQuery dnq)
 {
     return(dnq.GetExecutableQuery(Session).List());
 }
예제 #9
0
 public IList <TType> GetList <TType>(DetachedNamedQuery dnq)
 {
     return(dnq.GetExecutableQuery(Session).List <TType>());
 }