示例#1
0
        public void ExecuteMethodUntilSignal()
        {
            _startEvent.WaitOne(int.MaxValue, false);

            IAccountDao accountDao = daoManager[typeof(IAccountDao)] as IAccountDao;

            while (!_stopEvent.WaitOne(1, false))
            {
                Assert.IsFalse(daoManager.IsDaoSessionStarted());

                Account account = account = accountDao.GetAccountById(1);

                Assert.IsFalse(daoManager.IsDaoSessionStarted());

                Assert.AreEqual(1, account.Id, "account.Id");
                Assert.AreEqual("Joe", account.FirstName, "account.FirstName");
                Assert.AreEqual("Dalton", account.LastName, "account.LastName");
            }
        }
示例#2
0
        /// <summary>
        /// 返回指定类型的实体集合(SqlMap命名:query+EntityName+ListT)
        /// </summary>
        /// <typeparam name="Entity">返回集合类型</typeparam>
        /// <param name="map">查询参数</param>
        /// <returns></returns>
        public virtual IList <Entity> GetListByQuery <Entity>(Hashtable map)
        {
            IList <Entity> ilist = null;

            try
            {
                _daoManager.OpenConnection();
                ilist = dao.GetListByQuery <Entity>(map);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.Write(e.Message);
            }
            finally
            {
                if (_daoManager.IsDaoSessionStarted())
                {
                    _daoManager.CloseConnection();
                }
            }
            return(ilist);
        }