Example #1
0
        public void TestMappedStatementQueryWithReadWriteCacheWithSession()
        {
            IMappedStatement statement = sqlMap.GetMappedStatement("GetRWNSCachedAccountsViaResultMap");
            ISqlMapSession   session   = new SqlMapSession(sqlMap);

            session.OpenConnection();

            int firstId  = 0;
            int secondId = 0;

            try
            {
                // execute the statement twice; the second call should result in a cache hit
                IList list = statement.ExecuteQueryForList(session, null);
                firstId = HashCodeProvider.GetIdentityHashCode(list);

                list     = statement.ExecuteQueryForList(session, null);
                secondId = HashCodeProvider.GetIdentityHashCode(list);
            }
            finally
            {
                session.CloseConnection();
            }

            Assert.AreEqual(firstId, secondId);
        }
Example #2
0
            public void Run()
            {
                try
                {
                    IMappedStatement statement = _sqlMap.GetMappedStatement(_statementName);
                    ISqlMapSession   session   = new SqlMapSession(sqlMap);
                    session.OpenConnection();
                    IList list = statement.ExecuteQueryForList(session, null);

                    //int firstId = HashCodeProvider.GetIdentityHashCode(list);

                    list = statement.ExecuteQueryForList(session, null);
                    int secondId = HashCodeProvider.GetIdentityHashCode(list);

                    _results["id"]   = secondId;
                    _results["list"] = list;
                    session.CloseConnection();
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
Example #3
0
            public void Run()
            {
                try
                {
                    IMappedStatement statement = _sqlMap.GetMappedStatement( _statementName );
                    ISqlMapSession session = new SqlMapSession(sqlMap);
                    session.OpenConnection();
                    IList list = statement.ExecuteQueryForList(session, null);

                    //int firstId = HashCodeProvider.GetIdentityHashCode(list);

                    list = statement.ExecuteQueryForList(session, null);
                    int secondId = HashCodeProvider.GetIdentityHashCode(list);

                    _results["id"] = secondId ;
                    _results["list"] = list;
                    session.CloseConnection();
                }
                catch (Exception e)
                {
                    throw e;
                }
            }