Exemplo n.º 1
0
        /// <summary>
        /// This method fetches items from the cache using named tags.
        /// </summary>
        private static void GetItems()
        {
            string query = "SELECT Alachisoft.NCache.Sample.Data.Order WHERE this.Category = ? AND this.ProductName = ?";

            QueryCommand itemQuery = new QueryCommand(query);

            itemQuery.Parameters.Add("Category", "Beverages");
            itemQuery.Parameters.Add("ProductName", "Coke");

            ICacheReader result = _cache.SearchService.ExecuteReader(itemQuery, true);

            if (!result.IsClosed)
            {
                while (result.Read())
                {
                    Console.WriteLine(result.GetString(0));
                }
            }
        }