Пример #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");
        }
Пример #2
0
        /// <summary>
        /// Delete key value by namespace
        /// </summary>
        /// <param name="_namespace"></param>
        /// <param name="_key"></param>
        /// <returns></returns>
        // DELETE api/values/5
        public IHttpActionResult Delete(string _namespace, string _key)
        {
            bool result = false;

            try
            {
                IStoreKeyValue store = StoreKeyValue.Instance;
                result = store.DeleteKeyValue(_namespace, _key);
            }
            catch (Exception)
            {
                return(InternalServerError());
            }

            return(Ok());
        }