Exemplo n.º 1
0
        public void test()
        {
            Dictionary <string, object> a = new Dictionary <string, object>();

            a.Add("p:one", "p1");
            a.Add("p:two", "p2");
            a.Add("q:one", "q1");
            a.Add("q:two", "q2");

            object o = a["p:one"];
            var    k = a.Where(s => s.Key.Contains("p")).Select(d => d.Value);

            a.Remove("q:one");

            IStoreKeyValue store = StoreKeyValue.Instance;

            store.AddKeyValue("person", "id", "12003");
            store.AddKeyValue("person", "name", "prasanna");
            store.AddKeyValue("person", "email", "*****@*****.**");
            store.AddKeyValue("city", "name", "dubai");
            store.AddKeyValue("country", "name", "uae");
            store.AddKeyValue("test", "k1", "value01");
            store.AddKeyValue("test", "k2", "value02");
            store.AddKeyValue("test", "k3", "value03");

            var name = store.GetKeyValue("city", "name");

            store.DeleteKeyValue("test", "k1");

            var h = store.GetKeyValues("test");
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get key values by namespace
        /// </summary>
        /// <param name="_namespace"></param>
        /// <returns></returns>
        // GET api/values/5
        public IHttpActionResult Get(string _namespace)
        {
            IEnumerable <object> result = null;

            try
            {
                IStoreKeyValue store = StoreKeyValue.Instance;
                result = store.GetKeyValues(_namespace);
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
            if (result == null || result.ToList().Count < 1)
            {
                return(NotFound());
            }

            return(Ok(result));
        }