Ejemplo n.º 1
0
        private DataSet SelectIdentity()
        {
            DBCommandWrapper cmd = userDb.GetSqlStringCommandWrapper("select * from Users where UserName = @name");

            cmd.AddInParameter("name", DbType.String, userName);
            return(userDb.ExecuteDataSet(cmd));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads data from persistence store.
        /// </summary>
        /// <returns>Unfiltered hashtable of cache items loaded from persistence store.</returns>
        protected override Hashtable LoadDataFromStore()
        {
            DBCommandWrapper loadDataCommand = database.GetStoredProcCommandWrapper("LoadItems");

            loadDataCommand.AddInParameter("@partitionName", DbType.String, partitionName);
            DataSet dataToLoad = database.ExecuteDataSet(loadDataCommand);

            Hashtable dataToReturn = new Hashtable();

            foreach (DataRow row in dataToLoad.Tables[0].Rows)
            {
                CacheItem cacheItem = CreateCacheItem(row);
                dataToReturn.Add(cacheItem.Key, cacheItem);
            }
            return(dataToReturn);
        }
Ejemplo n.º 3
0
        public void LogToLoggingDatabase()
        {
            Data.Database    loggingDb = DatabaseFactory.CreateDatabase("LoggingDb");
            string           sql       = "delete [Log]";
            DBCommandWrapper cmd       = loggingDb.GetSqlStringCommandWrapper(sql);

            loggingDb.ExecuteNonQuery(cmd);

            Logger.Write("test message", "LoggingDbCategory");

            sql = "select * from [Log]";
            cmd = loggingDb.GetSqlStringCommandWrapper(sql);
            DataSet ds = loggingDb.ExecuteDataSet(cmd);

            Assert.AreEqual(1, ds.Tables[0].Rows.Count);
        }