public void TestConnection() { using (ISession session = OracleSessionFactory.GetInstance().OpenSession()) { ConnectionState state = session.Connection.State; Assert.AreEqual(session.Connection.State, state); } }
public virtual IList <CITY> TestGetData(string sql, IDbOp op) { ISession session = OracleSessionFactory.GetInstance().OpenSession(new TestInterceptor()); IQuery sessionCreateQuery = session.CreateQuery("from CITY"); IList <CITY> pList = sessionCreateQuery.List <CITY>(); return(pList); }
public virtual IList <CITY> TestCacheGetData(IDbOp op) { using (ISession session = OracleSessionFactory.GetInstance().OpenSession()) { IQuery sessionCreateQuery = session.CreateQuery("from CITY"); IList <CITY> pList = sessionCreateQuery.List <CITY>(); return(pList); } }
static void Main(string[] args) { ISession session = OracleSessionFactory.GetInstance().OpenSession(new TestInterceptor()); NHCacheTest test = IocCoreFactory.Get <NHCacheTest>(); test.TestGetData("select * from city", OracleSessionFactory.DbOp); test.TestGetData("select * from city", OracleSessionFactory.DbOp); //IQuery sessionCreateQuery = session.CreateQuery("from CITY"); //IList<CITY> pList = sessionCreateQuery.List<CITY>(); //Console.WriteLine(pList.Count); //Console.ReadLine(); ////session = SessionFactory.GetInstance().OpenSession(new TestInterceptor()); ////sessionCreateQuery = session.CreateQuery("from CITY"); //session.Evict(pList); //pList = sessionCreateQuery.List<CITY>(); //session.Close(); Console.ReadLine(); OracleSessionFactory.Dispose(); Console.ReadLine(); #region //IDbOp op = IocCoreFactory.Get<IDbOp>(); //op.Open(); //CacheTest test = IocCoreFactory.Get<CacheTest>(); //test.TestGetData("select * from bpxm t",op); //test.TestGetData("select * from bpxm t", op); ////op.Close(); ////op.Open(); ////Thread.Sleep(2000); ////test.TestGetData("select * from bpxm t", op); ////Console.ReadLine(); ////test.TestGetData("select * from bpxm t", op); ////Console.ReadLine(); //op.Close(); //Console.ReadLine(); #endregion #region //IDbOp op = IocCoreFactory.Get<IDbOp>(); //bool a = false; //ConsoleKeyInfo keyInfo; //while (!a) //{ // if (System.Console.KeyAvailable) // { // keyInfo = System.Console.ReadKey(true); // if (keyInfo.KeyChar == 'a') // a = true; // } // op.Open(); // op.CacheQuery("select * from bpxm t"); // Thread.Sleep(2000); //} #endregion }